Question: Build a 'War' card game simulator. We will run the simulation with various numbers of cards and decks of cards to see how many turns

Build a 'War' card game simulator.


We will run the simulation with various numbers of cards and decks of cards to see how many turns a game takes on average ( each starting deck size run 100 times or so to get the average ).

Ace is the highest card. 2-Ace of each each suit, 52 cards total per deck.

2 Players, each have a 'stack' of cards, when you win, add the cards to the bottom, the game is over when 1 player runs out.

On a 'tie' or 'war', have each player add 2 cards to the pile and then check the 3rd card.


Plot the results at the end.

Step by Step Solution

3.32 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To simulate a War card game you can use Python Heres a simplified version of the game simulation import random import matplotlibpyplot as plt def init... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!