Write a program that runs a simple computer vs human card game. You should use the basic C/C++ features like:
The game uses one French deck of cards with 4 suits (heart, diamond, spades and clubs) and 13 cards per suit (numbered 1, 2, 3, , 10, Jack, Queen, King). The principle is simple:
The game is played in multiple rounds. When the first round starts, 4 random cards are drawn from the deck and placed on the table. At each round, each player gets a hand of three random cards.
One by one, the players would match one card from their hands with cards from the table such as it is either
The player who matches cards (either one to one or one to two) wins them.
If no matching is possible, the player has to add one of his cards to the table
At the last round, the last player making a match wins the cards left on the table without matching
The game ends when there are no cards left in the deck to be distributed. With a simple count, we can find that there are 8 rounds (13 x 4 = 52 cards per deck, take 4 for the initial table, 48 are left for playing. In each round, each player gets 3 cards so 6 cards in total. 48/6=8 rounds)
The winner is the player who has won the largest number of cards.
Note:
When playing, the computer does not take into account the cards in the hand of the opponent. Its decision is based only on his cards and the cards on the table.
However, when the human player makes a match, the computer needs to check that the human is not cheating. So, it needs to check that: