After playing the card game War recently, I wonder about the probability of winning, and on average, how many “battles” were fought and how many wars waged in a single game? Intuitively, I figured the odds of winning were 50-50 because there really is no strategy to the game; it’s all chance.
To explore my intuition, I wrote a War card game simulator in a Jupyter Notebook. Interestingly, I found the odds usually came out to be about 40-60 in favor of player 2 winning, with an average of about 188 battles and 13 wars per game (sample size = 1,000 games).
SUMMARY ============================= Games played: 1000 Player 1 wins: 405 Player 2 wins: 595 Total hands played: 188784 (min. hands: 14 , max. hands: 885 ) Avg. hands/game: 188.784 Total wars waged: 13646 (min. wars: 1 , max. wars: 70 ) Avg. wars/game: 13.646 =============================
The results did not change significantly with a sample size of 10,000. Is there a bug in the code, or is it really advantageous to always be player 2?
The chart exposes some interesting insights, most notably, once a player starts winning, they continue to win. But on a smaller scale, say 10 games, there is more variability.

Here are the rules I used in the simulation:
Number of players: 2
Objective: Collect all of the cards in a standard deck of playing cards (excluding Jokers).
- The entire deck of cards is dealt in an alternating fashion to each player (each player receives 26 cards).
- Player 1 lays a card from the top of their deck face up on the table. Player 2 does the same.
- The card with the highest value wins the “battle”. The winning player collects all of the cards and sets them aside, face down. (Cards are valued 2 – A with 2 the lowest card and Ace the highest.)
- This process continues until each player lays down a card of equal value. This is a war!
- Procedures for a war:
- a. Each player lays down three cards face down.
- b. The fourth card is dealt face up. The card with the highest value (same as rule #3) wins the war and collects all of the cards.
- c. It is possible that the “war” cards could be of the same value, which incites an additional war. In this case the process repeats (steps a and b). The winner takes all of the cards.
- d. If a player does not have enough cards to complete the war (4 cards), they lose and the other player wins by default.
- When a player exhausts their deck of cards, their discard deck is played (without shuffling).
Mostly this was an excuse to have some fun programming in Jupyter Notebooks and using MatPlotLib. Any insight or comments would be appreciated. The Jupyter Notebook is here.

One thought on “War Sim (the card game)”