Question
The game company, Silly Little Games, has come up with a new card game for you to simulate. It uses a special set of cards
The game company, Silly Little Games, has come up with a new card game for you to simulate. It uses a special set of cards that contain the numbers 1 to 13 and there are four copies of each card in the deck. The first person to play all the cards in their hand wins. The game is played as follows:
The cards are shuffled and placed into a stack Each player is dealt 7 cards from the stack in a round-robin fashion and their cards are placed into their queue The next card in the deal stack is placed into the discard stack For their turn, each player plays the next card in his/her queue. If the card the player plays is HIGHER in number than the one on the top of the discard stack, the player's turn is over. If the card the player plays is EQUAL in number to the one on the top of the discard stack, the player must then take one card from the deal stack and the player's turn is over. If the player's card is LOWER in number than the one on the discard stack, the player must take two cards from the deal stack and the player's turn is over. If the deal stack runs out of cards, "turn over" the discard stack and continue the game. Note that you must keep the same card on the top of the discard stack, so you will need to hold onto that card and push it back onto the discard stack before continuing the game. The first player to run out of cards wins the game. Offer to repeat the game as many times as desired.
Notes:
There are only two players. You may ask for names or simply call them by whatever names your game chooses. Remember to design your user interface carefully. You must use a stack for the shuffled cards, a stack for the discard pile and a queue for each player - all of type int.
There are 5 file in this program. "stack.h", "stack.cpp","queue.h","queue.cpp","main.cpp". The stack got 3 function push(int data), pop(int& data), and isEmpty() const (stack is able to resize if it needs to). The Queue also got 3 function enqueue(int data),dequeue(int& data), and is Empty() const. I did all the first 4 file but I have no idea how to do the "main.cpp". The code has to be written in C++.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started