Requirements

The goal of this project is to help you get started with C# programming. No graphics or game engine is involved.

  • Use C# to implement a simple card game. The specific gameplay is described below.
  • This is a text-based game. You will develop the game as a C# console program. A player plays the game by typing commands. Do not create graphics or GUI.
  • This is a C# and .Net API project. Do not use any game engine. Do not use Unity.
  • Gameplay
    • This game must have two players: one human player and one AI player. You will need to implement some simple rule-based AI.
    • In the beginning, 52 cards are shuffled and distributed evenly so that each player has 26 cards.
    • In this game, aces are highest, and twos are lowest. The suit doesn't matter.
    • At each round, the human player presses the Enter key to turn over the top card. The AI player automatically does the same.
    • The player with the higher card will collect both cards and insert the two cards to the bottom of his/her pile.
    • If the two cards have the same value (e.g., two Jacks), then each player pulls three more cards from the top of their pile and set them aside. For the human players, the three cards are automatically pulled from his/her pile. Then, each player turns over another top card from their pile and compare. Now, the player with the higher card will collect all 10 cards and insert the cards to the bottom of his/her pile. If the two cards are still the same value, repeat the above process.
    • The game ends when one player collects all 52 cards. At this point, display a message showing the winner and ask to start over or exit.
  • You must use object-oriented programming. For example, your program should include, but not be limited to, the following classes.
    • Card class.
    • Player class. This is the base class for HumanPlayer and AIPlayer classes.
    • The HumanPlayer class is derived from the Player class. Additional fields and methods may be added. You need to implement the necessary game logic in the methods in this class.
    • The AIPlayer class is derived from the Player class. Additional fields and methods may be added. You need to implement the necessary game logic in the methods in this class.
    • You need to write a class PlayCards that contains the main() method. The main() method contains the main game loop.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.