Game of War is a card game I got re-introduced recently. It sparked my interest because its outcome is almost completely determined by the hands dealt at the beginning of the game. I was already refreshing my Rust skills using the current Advent of Code so I thought it a good opportunity to give into my curiosity and learn some more about this game.

Because I wanted to keep it fun I did not research anything about this game. This is likely fully studied and available somewhere else on the internet. If you are looking for a correct analysis, look elsewhere. This is an exploration and description of my journey, because it is fun.

I can recommend to read the wikipedia article linked above to learn more about the game, I will not explain the rules here. I will also only consider the two-player version of this game, though most of the observations will also apply to versions with more players. I am also aware that the version of the game I have modelled and simulated (in Rust) is not exactly how it is described online. There seem to be many slightly different version of this game, and the version I learned and modelled was taught to me under slight intoxication after a long day so there be errors. Speaking of, for the slight chance that the person who taught me this game is reading this 👋 thanks for the nice day, and thanks for teaching this game to me.

As of writing this I am still running a larger set of simulations, and I am planning to run more detailed stats later too.

Observations

  1. Randomness is only introduced by the way the cards that are won are picked up.
  2. Game states can repeat, and the game can still come to an end.
  3. Stategy can be applied to the way cards are picked up to optimise the outcome.

Simulations

I ran some of the smaller sample size simulations on my M1 Macbook Air, the longer and larger simulations were run on a DigitalOcean Droplet. On a single core I was usually able to simulate between 30k and 50k games per second. The games have a very small memory footprint, in part thanks to rust, so I am also planning on parallelising the simulation.

Here are some preliminary results on game length:

Counting the number of games that end with a certain number of turns. Both the starting hands and the way cards won are picked up (constrained as described above) were randomised uniformly.

What this data tells us already:

I can share the CSV containing the result of the simulation, counting the number of games ending at a certain turn count.

TODO

These are as much TODOs for me as they are invitations to anyone reading this to research this further: