Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program involves writing a VERY simplified version of the card game War. You may know this game or not but my rules are these

image text in transcribed

This program involves writing a VERY simplified version of the card game War. You may know this game or not but my rules are these 1. Split the deck between player1 and player2. Only the face values matter (2-14) and not the suits 2. Each player puts a card down on the table. The higher face value wins that hand. If the card values match, you will simply indicate tie and neither player wins.The original rules would require you to use a queue, linked list, or dynamic array so that the winning player keeps the cards from the hand. l've cut that part out of this game. Just play each players 26 card deck 1 time and tally the results You can use a 2D array or 2 1D arrays to hold the 52 card deck. No need to store suits. You will want to place the face values (4 each of 2-14) into one array and a boolean or other appropriate value in the other array to make sure you don't draw the same card twice. Your players will each have their own array of 26 cards -The cards MUST be randomly given to the players so that their order within each player's deck is never the same. Just generate a random number between O and 51. If the value in the deck has already been given out, generate another random number and try again. How do you know if it has been given out? That's what the second array (2 x 1D arrays) or second row (in a 2D array) is used for -The player with the most hand wins is the game winner. If there is a tie, indicate that the game is a tie -You will output the game to the screen in this way: Player1 Player2 Winner 12 3 7 13 etc.. Game Winner is Player1! Player1 Tie Player2 Player1 14 2

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

Bioinformatics Databases And Systems

Authors: Stanley I. Letovsky

1st Edition

1475784058, 978-1475784053

More Books

Students also viewed these Databases questions

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago

Question

Explain the chemical properties of acids with examples.

Answered: 1 week ago

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago