Skip to content

Intermediate C# Programming: Card Games Introduction

Project Overview

This project is a C# console framework for multiple card games. We'll leverage object-oriented principles to reduce redundancy and make it easy to add more games later. To start, we will have three simple card games that will reinforce your knowledge of C#, UML, and object-oriented programming. Once we've completed the framework you can swap out the simple games for more

This is an intermediate project. If you are just starting out with C#, work through the C# Adventure Game first to learn the language and fundamentals of object-oriented programming.

Screenshot of card game application.

Card Game Commonalities

There are many different types of card games (such as matching and collecting cards). Even though they might be classified as different types, they still have similarities. For example, they all use multiple cards, they all have players, and they all have one or more win conditions.

Identifying these commonalities will help you in creating a modular framework. Although the games themselves may be different, we will create shared components. You will write less redundant code, and learn more about object-oriented programming. This process is part of computational thinking.

Computational Thinking

Computational thinking allows us to take a complex problem, understand what the problem is, and develop possible solutions. These solutions are then presented in ways that both a computer and a human can understand.

  • Decomposition: Break down problems into manageable parts
  • Pattern recognition: Identify structures and connections
  • Abstraction: Focus on important information only, ignoring irrelevant detail
  • Algorithms: Develop a step-by-step solution to the problem

Card Game Patterns

A photograph of a deck of cards split into a draw pile and a discard pile.

What are some of the patterns card games share?

Review these games and make notes about the patterns you see.

Card Game Questions

A photograph of a hand of cards.

How will the card game classes be designed? These questions can help:

  • Do all card games have one single deck?
  • Looking across a variety of card games, do players always have a hand of cards?
  • What are the properties of a card game?
  • What are the actions (verbs) that occur during a card game?

Card Properties

What are the defining properties of a card? In other words, how do you know something is a card when you see it? Listing the properties will help you in creating a card class for the project.

  • What makes a card identifiable as a playing card?
  • What are the possible values a playing card might have?
  • Does the value of a card ever change between games, or within a game?

Example Screenshots

These screenshots show one way our application could look.

Screenshot of a card game framework Screenshot of a card game called "High-Low" Screenshot of a card game

To Do

Assignment: Identify Patterns and Properties

This is an important step; you are defining fundamental parts of the application.

  1. List the patterns you see across several card games.
  2. List the properties of a single card.

Next Step

The next step is to create a draft of the structure of your application.