Overview:

You are to implement a computer-based variant of the card game War. This is a two-player card game played with a standard deck of cards in which the aim of the game is to capture all cards in the deck. When one player has all 52 cards, the game is over.

Basic Play:

To begin, all 52 cards from a standard deck of cards are evenly split randomly between two players. The game plays as follows:

  • Each player turns over the top card in their deck. This is called a Battle.
  • Whichever player has the highest card claims both cards and puts them at the end of their collection. The value of the card is based on the number value, with 2 being the lowest and Ace being highest. Picture cards are ordered lowest to highest Jack, Queen, King, Ace.
  • If both cards have the same value, War breaks out (detailed below)
  • This continues until one player has all 52 cards, in which the game ends War: If the value of both cards is the same, War takes place. It has the following rules:
    • Each player takes the top 4 cards from their deck. The 4 th card is revealed. Whoever has the highest value on that 4 th card claims all cards. If it is a draw again, this process is repeated.

Game Modes:

Your game should have two modes that can be chosen at the beginning of your program:

1. Versus Computer Mode In this mode one player can play against a computer opponent

2. Simulation Mode In this mode you simulate a complete game with no human players. At the end of the game, you must report on who won, how many battles and how many wars occurred in the game

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.