Louise is creating a card game for two players.
The game uses a deck of cards. There are 30 cards in a deck. Each card has one colour (red, black or yellow). Each card has a number (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) for each colour. Each card is unique.
The 30 cards are shuffled and stored in the deck.
The rules are:
- Player 1 takes the top card from the deck.
- Player 2 takes the next card from the deck.
- If both players have a card of the same colour, the player with the highest number wins.
- If both players have cards with different colours, the winning colour is shown in the table.
- The winner of each round keeps both cards.
- The players keep playing until there are no cards left in the deck.
Only authorised players are allowed to play the game.
Where appropriate, input from the user should be validated.
What your program needs to do
- Allows two players to enter their details, which are then authenticated, to ensure that they are authorised players.
- Shuffles the 30 cards in the deck.
- Allows each player to take a card from the top of the deck. Play continues until there are no cards left in the deck.
- Calculates the winner and allocates both cards to the winner.
- Displays which player wins (the player with the most cards).
- Lists all of the cards held by the winning player.
- Stores the name and quantity of cards of the winning player in an external file.
- Displays the name and quantity of cards of the 5 players with the highest quantity of cards from the external file.