Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please create a program that simulates the game of war. The input should read se

ID: 3638542 • Letter: P

Question

Please create a program that simulates the game of war. The input should read several lines with 52 cards (no suits) dealt to each player. The cards dealt first end up in bottom of pile. In each round both players play a card, and the player with the higher card wins the round and keeps both cards. They place the winning cards at the bottom of the pile. If the new face-up cards are equal the war continues: each player puts another card face-down and one face-up. The war goes on like this as long as the face-up cards continue to be equal. The winner gets all the cards in the round and places it in the bottom of the pile. Once one player has all 52 cards the game is over and that player wins.

sample input:
6 4 5 7 2 3 10 5 2 4 J 7 3 Q 10 J A A K 8 2 2 3 3 9 9 4 9 8 A Q K Q J A 9 8 6 8 10 6 10 5 Q 7 4 6 K 7 K J 5
2 5 7 Q 9 7 A 3 J K 9 Q 10 A 10 8 9 6 4 2 8 K Q 3 5 9 6 3 A J Q 10 5 6 2 10 4 3 4 4 A J 7 J K 6 5 8 7 8 2 K
6 3 9 6 4 Q 4 5 8 A Q 2 3 8 3 4 9 2 8 7 10 J K Q J 5 3 A 10 A 6 5 8 2 J 10 9 K 4 Q 7 7 A 6 10 2 5 7 J K K 9

Sample output:
2 wins after 921 rounds
1 wins after 440 rounds
draw after 20000 rounds

the output should print the result and how many rounds it takes. " Player 2 wins after 12 rounds" . If it takes more than 20000 rounds than it should print "draw after 20000 rounds". **Implement and use a linked list class.

Explanation / Answer

Hello. We cramster experts have decided not to provide any answer publicly. That is because people are copying from older threads which have public answers. Hence we'll only send the answer after you rate. So please rate a Lifesaver and I'll send the solution to your inbox or email. You've got no other option to get the answer, because no one is going to give you the answer over here. You need not worry as I have the solution ready in my notebook. Hope you rate me :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote