In the card game War you deal a standard 52 card deck between two players. The players than flip cards with the higher card winning. In the case of ties (wars), each player plays N additional cards an the player with the highest Nth card wins all the cards (subsequent ties follow the same rules). The game can last a very long time and seems to never last a short time.

What is the expected number of "turns" until the game is completed?

I learned to play war with N equal to 3 (i.e., a total of 10 cards are played in a war: the original tie, 3 face down, and a final comparison card).

For completeness assume the game is over if a player has less than 5 cards and gets into a war (i.e., does not have a final card to flip).

Assume that upon playing your last card from your hand, you shuffle the winning cards into a random order and resume.

Assume the cards are in random order to start.

  • According to the Wikipedia article you linked, both players play two addition cards, not four. The winner then takes all four (2*2) cards. – Phil Dec 3 at 16:34
  • Also, it would depend on how the captured cards are returned to the winner's deck. If they are just placed in bottom of the deck, then that might affect the answer to the question. Furthermore, if the 52 cards are divided perfectly into two identical piles, I would assume that the game ends in a tie? Would that count as the game being completed? – Phil Dec 3 at 16:37
  • @Phil you are correct, not how I grew up playing and not how my son learned from friends, but okay. Will update. – StrongBad Dec 3 at 16:37
  • @Phil does the edit cover everything? – StrongBad Dec 3 at 16:42
  • 2
    This might be a better question for the math forum, as they tend to be better at complicated probability questions. – Arcanist Lupus Dec 3 at 20:31
up vote 8 down vote accepted

War is actually not a game but an Automata, as players don't have any options.

Wimpy Programmer already made this simulation, he found that when shuffling the winning cards, the mean number of turns is 262, the mode is 84, and the max (on a sample of 100,000 trials) is 2,702 turns. He also found that without shuffles of the winning cards, the game might be endless.

He used N=2 while you play with N=3, higher N shortens the game, however I don't think that it will make a big difference.

turns of war untill someone wins (thousand)

As a math problem, this is a case of a random walk ("walking" N cards at a step from your opponent's deck to your deck, where N is usually one, but can be 4 or 7 or whatever depending on ties.) It is often framed as the "gamblers ruin" problem. Ignoring the issue of ties and treating each throw of cards as an independent trial, the average number of turns is 26*26 = 676 turns.

Factoring in ties would reduce it quite a bit based on N -- allowing for bigger steps occasionally. The average number of turns when the step size is 5 (i.e., every turn is a war that is resolved on its first tiebreak) is equivalent to playing with 6 cards each (26/5, rounded up). And 6*6 = 36 turns.

So then it's just a matter of figuring out the probability of big steps. Ties can be expected about 3/51 of the time (when you play a card, there are 3 cards that can tie it out of the 51 other cards). 48/51 = step size 1, 3/51 * 46/49 = step size 5, 3/51 * 3/49 * 44/47 = step size 9, and so on. This makes an average step size of about 1.25. A game played with all steps equal to 1.25 would be expected to last about 21*21 = 441 turns (26/1.25 = 21 cards each equiv). And then reduce that some more to factor in the chance for sudden death when one of the ties occurs when a player is low on cards. (Sorry I don't have the details on how to do that exactly.)

EDIT: I should also emphasize that this approach assumes the trials are independent trials. That's basically the difference between dice and cards. Each throw of a die is independent. But each draw is not -- it depends on what else has been drawn / what else remains. And in the case of War, winning a trial in general improves your odds on the Kth following draw (when you draw that card again). It's a very mild (IMO) runaway leader effect (mitigated by also receiving the losing card, but I still think the net is a gain). And it will multiply the advantage, if any, bestowed to one player over the other in the initial deal. That is, any slight deviation toward the higher-numbered cards in the initial deal will be amplified each successive trip through the deck.

Further reading:

Simple Random Walk: http://www2.math.uu.se/~sea/kurser/stokprocmn1/slumpvandring_eng.pdf

First Passage of a One-Dimensional Random Walker https://www.math.ucdavis.edu/~tracy/courses/math135A/UsefullCourseMaterial/firstPassage.pdf

Well, from that same link you shared, on the summary table on the right reads:

Playing time 10–40 min.

Which directly says the average duration of a game.

Now, turns on this game, as per my experience, are quite fast. They can last a few seconds (reveal cards, someone wins, cards are taken, end of turn), or in case of a tie some extra few seconds.

So, assuming a turn lasts in average 10 seconds, we can transform that average duration from time units to turns. Best case (10 mins) it will take 60 turns to complete, worst case (40 mins) it will take 240 turns.

  • 1
    Perhaps the OP can clarify, but I interpreted the question as asking about probability and statistics; what is the average expected number of turns given the factors we know. – GendoIkari Dec 3 at 20:38
  • 1
    @GendoIkari yes that is what I meant. It seems like a more accurate answer than starting with an estimated time and trying to infer turns. – StrongBad Dec 3 at 21:11
  • @GendoIkari Although my approach was not so rigorous, it is probabilistic. We have the average duration of these games. We also can obtain an average turn duration, based on the dynamics involved (which are quite few, drawing cards, showing it, someone wins, or tie) and from domain knowledge (having played the game several times myself)... but yes, this could be more rigorous. Perhaps making a small program simulating the game will yield a better estimate :) – DarkCygnus Dec 3 at 21:21

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.