Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im having trouble altering these files to output what I wan them to output. details--> The game company, Silly Little Games ,has come up with

Im having trouble altering these files to output what I wan them to output.

details-->

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 (if you want to try out this game with a regular card deck, you can make Ace = 1, Jack = 11, Queen = 12, King = 13). 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.

sample output:

image text in transcribedimage text in transcribed
Welcome to Silly Little Games' new Card Game! (add information to describe the game...) Good luck!!!! Cards in hand. Player 1: 13 6 3 2 9 10 5 Player 2: 2 12 8 12 13 3 6 Player 1's turn. Top of the stack is 12. Your card 13 is larger than 12. Good job! Cards in hand. Player 1: 6 3 2 9 10 5 Player 2: 2 12 8 12 13 3 6 Player 2's turn. Top of the stack is 13. Your card 2 is less than 13. You pick 2 cards. Cards in hand. Player 1: 6 3 2 9 10 5 Player 2: 12 8 12 13 3 6 11 8 Player 1's turn. Top of the stack is 2. Your card 6 is larger than 2. Good job! Cards in hand. Player 1: 3 2 9 10 5 Player 2: 12 8 12 13 3 6 11 8 Player 2's turn. Top of the stack is 6. Your card 12 is larger than 6. Good job! Cards in hand. Player 1: 4 3 9 5 12 8 6 1 Player 2: 11 9 8 Player 2's turn. Top of the stack is 7. Your card 11 is larger than 7. Good job! Cards in hand. Player 1: 4 3 9 5 12 8 6 1 Player 2: 9 8 Player 1's turn. Top oF the stack is 11. Your card 4 is less than 11. You pick 2 cards. Cards in hand. Player 1: 3 9 5 12 8 6 1 13 2 Player 2: 9 8 Player 2's turn. Top of the stack is 4. Your card 9 is larger than 4. Good job! Cards in hand. Player 1: 3 9 5 12 8 6 1 13 2 Player 2: 8 Player 1's turn. Top of the stack is 9. Your card 3 is less than 9. You pick 2 cards. Cards in hand. Player 1: 9 5 12 8 6 1 13 2 11 9 Player 2: 8 Player 2's turn. Top of the stack is 3. Your card 8 is larger than 3. Good job! Cards in hand. Player 1: 9 5 12 8 6 1 13 2 11 9 Player 2: Player 2 won! Do you want to play again? (y): n Thanks for playing the Card Game

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions