Skip to content

Thoughts #002

Published: at 12:00 AM

I love both chess and card games. In fact, I’ve loved chess for a long while now, but my love for cards has only rekindled very recently when I reminded myself of the games I used to play during my childhood.

I went to the store and purchased a nice deck of playing cards and decided to kick things off with probably the simplest card game there is: War. It’s a really easy game for 2 players. In fact, the rules for war are so small that I can actually fit it in this blog post without it being slumberous:

  1. Split deck in half.
  2. Place down one card each.
  3. Compare ranks - the person with the higher rank takes both cards and puts them in the bottom of their deck.
  4. If ranks are equal, then war is declared - two other cards (I like to call them “captives”) are placed face down, these act as surprise cards. Afterwards, a third card is placed down and is compared. Repeat until one side has a higher ranked card, winner takes all.
  5. Repeat until either player wins all the cards.

In a vacuum, it’s a very boring game. In fact, it’s all up to luck — whatever cards you got are the cards you’re stuck with. Except you’re not.

Breaking Things

I love and hate the fact that I try to minmax everything I touch. Grug brain discover new shiny thing? Grug brain must optimize to oblivion. I hated that everything was up to chance, and so I kept digging, am I really left to fate’s decisions? No!

See, there is one thing that the rules state nowhere — when you win a turn, you must place the winning cards at the bottom of your deck, but it’s never stated in which order. This was enough for me to start coding up a simulation in Julia and to start testing. Theoretically, if you’re cheeky and smart enough (or if you know enough about probabilities and how the game plays) you should be able to maximize your chances of winning even from a losing position, just by expertly manipulating the order in which you return your cards to the deck!

Better yet, you can be turbo cheeky during gameplay and also manipulate the cards of your opponent. War is a social game and, in order to pass the boring time, you end up talking and joking a lot, so this gives you some wiggle room. When you lose a pair, you can tactically place your card at the top of your opponent’s card or beneath it (if you can flick the card skillfully underneath, which I’ve learned to do while making it look very natural, mind you). Your opponent will usually just take the cards as they are and place them at the bottom of their deck, and boom — you’re now a master manipulator, and you can bend the game’s chances to your heart’s desire. As to whether such a “technique” would be considered cheating, I leave that up to you1 :p

Either way, back on track: we can manipulate two cards, it’s not much, but it should be enough to let us get an edge and develop some strategies. And, as you know, limitations breed creativity, so that’s what I want to pursue in this side quest.

After a lot of work on the simulation and making sure it was reflective of the actual card game, I got to testing. As it turns out, many people have recognized that you can manipulate card order before me, but it seems that nobody has yet taken it to the extreme. I found this research paper on various strategies of War, and the findings here seem to line up almost 1:1 with my simulation of 1 million games.

This is all fantastic, but I’d like to take it further, for no reason other than to entertain myself. After all, winning such a game consistently would feel like predicting the result of a coin toss correctly each time — you’d be perceived as a magician. Everyone seems to have only considered static strategies (not even scispace can find any special papers on War), but I’m fairly certain that you can do some bonkers card counting and strategic planning in order to give yourself a consistent edge over any opponent as you’re playing the game. For this reason, we need a framework with which we can reason about the game.

The Algebra of War (seriously)

Over the past few days I’ve been on and off, for 30 minutes at a time, trying to construct a simple algebra for the game — operators that compare decks and simple properties and equalities.

I’ll also be giving The Combinatorics of War a serious read in hope of building on prior work. From there, I’d like to start getting good at the various static tactics in order to prepare for the dynamic ones. Lots of stuff ahead!

The Future

I don’t really take this project seriously, but every now and again this feel like an itch that needs scratching. I think there’s a lot of really cool mathematical things to learn for me from this project, like the behaviours of repeating sequences and extreme combinatorics. As I discover cool things, you bet I’ll be updating you in these thoughts!

If I ever make a comprehensive framework, I’ll definitely take the time to develop an entire blog post to the matter :)

Footnotes

  1. While it is true that this preys on the lack of the opponent’s knowledge, in tactical showdowns there would be nothing stopping your opponent from flipping the cards to their desired configuration anyway, so you’re not getting an irrevocable, decisive advantage using this.