Simulating a Zombie-Themed Dice Game to Learn about Probability

How good is your intuition of probability?

Jan Van Zeghbroeck
The Startup
10 min readSep 26, 2019

--

I find probability fascinating. Probability is the mathematical expression of randomness and thus a way to help us understand it. Outside of math class, we experience randomness all the time and because of that we all also have some innate understanding of probability. It is not by accident that so many games involve rolling dice, or that the lottery is played by an absurd number of people, or that gambling addiction exists in our society. We love randomness and the idea of chance.

Randomness allows a newbie to beat a seasoned player. It allows for the opportunity to get rich. It comforts us and tells us that flying is safe despite the bumps. It can make us feel like the luckiest person on the planet. It tells us that anything and everything is possible — randomness can provide us with incredible feelings of hope, security, and uniqueness.

Because randomness is so connected with our emotions there is no surprise that our innate understanding and the mathematical understanding of probability don’t always agree. However the more I compare the two, I find that we disagree more often than not.

The Gamblers Fallacy and Monty Hall Problem are famous examples that demonstrate how we often have a tough time understanding how probability really works. I hypothesize that one of the reasons for this is that we often mistake luck for skill. This is most easily understood by playing a game that involves both skill and chance. While poker and other games found on the casino floor are the most common examples, I wanted to look into the probability of a less-known more casual game called Zombie Dice.

Zombie Dice Rules (feel free to skip to the next section)

Zombie Dice is played with players taking turns rolling dice to collect points, the first to 13 wins. Players play as zombies 🧟‍🧟‍♀️ and “chase” tasty humans who are represented by dice 🎲.

There are three types of dice: 6 green, 4 yellow, and 3 red. Each color has differing combinations of the following on each of their sides:

  • Footsteps 🦶indicating that the human has escaped the zombie
  • A Brain 🧠 indicating that the zombie has successfully snagged a tasty brain (the points of the game)
  • A Shotgun shot 🔫 indicating that the human has shot and wounded the zombie player. If a zombie player gets shot 3 or more times, they are knocked down for the round, just like baseball — three strikes and you’re out!

A jar-type container holds the dice and starts with six green 💚dice 🎲 each having more sides with brains than shots (1x🔫, 3x🧠, 2x🦶), four yellow 💛dice 🎲 have an equal probability of all three (2x🔫, 2x🧠, 2x🦶), and three red ❤️dice 🎲 with more sides with shots than brains (3x🔫, 1x🧠, 2x🦶).

Summary of game peices:
A full jar contains: 6x💚💚💚💚💚💚 🎲, 4x💛💛💛💛 🎲, & 3x ❤️❤️❤️ 🎲
Green 💚 dice 🎲 has: 1x🔫, 3x🧠🧠🧠, 2x🦶🦶
Yellow💛 dice 🎲 has: 2x🔫🔫, 2x🧠🧠, 2x🦶🦶
Red ❤️ dice 🎲 has: 3x🔫🔫🔫, 1x🧠, 2x🦶🦶

Each player’s turn then plays out like so:

  1. Pull 3 random dice 🎲 from the jar and roll them.
  2. Set aside any dice that result in brains 🧠 or shots 🔫.
  3. If you have 3 or more shots 🔫 you’re done for this round, put all dice into the jar and pass it to the next player. Otherwise, continue to step 4.
  4. Return all dice with footsteps 🦶to the jar.
  5. You then need to decide if you would like to stop rolling or continue rolling. If you choose to stop rolling, count the number of brains 🧠 you have and add it to your total score, return all the dice back to the jar and pass it to the next player. If you choose to continue rolling, continue to step 6.
  6. Repeat the process starting at step 1.
  7. The first player to 13 wins.

Example Turn:
You randomly pull 3 green 💚dice 🎲 (what luck!), roll them, and get one shot and two brains (1x🔫, 2x🧠, 0x🦶). You now have a decision to make: do you keep rolling? Looking back into the jar you see an even split of three green, four yellow, and three red dice, “even odds” you think, and decide to go for it. You randomly pull three red ❤️dice 🎲 (bad luck!) and roll one of each (1x🔫, 1x🧠, 1x🦶). You now have 3 brains and 2 shots. You decide that it’s too risky to keep rolling and you take your 3 points and pass the jar to the next player.

The strategy here is similar to blackjack and involves weighing the odds of getting shot three or more times based on the remaining dice in the jar versus maximizing the number of brains you can roll. The classic risk vs reward game of chance. Here is a link to a Zombie Dice YouTube instructional video if you would like to watch a tutorial on how to learn to play.

Our intuition of probability

Most people intuitively start by playing Zombie Dice the same way. Players do some mental calculations to make a yes/no decision. This starts with them looking at which dice are in the jar and comparing their perceived odds with how many shots and brains they currently have to weigh the risk versus reward. More specifically they follow this three-step process:

  1. Based on how many red dice vs green dice are in the jar, what are the chances of randomly drawing a good or bad combination of 3 dice?
  2. Given the number of shots I currently have, what are the chances of getting knocked out?
  3. Given the number of brains I currently have, is it worth it to keep rolling?

Step 1 is where we first judge the majority of the probability of the game. With only 13 dice and each being only one of three options, players tend to have a good intuition of which combinations are better than others. This usually boils down to the simple mental framework where more red dice are bad and more green dice are good. So if the ratio of green to red dice is favorable players tend to go for it.

The math to calculate the probability of pulling any combination of three dice is pretty easy as well. For example, the worst-case scenario on your first roll of the game is pulling three red dice which only has a 3.5% chance of actually happening.

Step 2 in the mental calculation aims to take the relative odds calculated above, translate it into shots, and judge how likely the player is to get out.

Once we have the three red dice from above in our hand the expected outcome of the roll is pretty easy to calculate as well. Given that each red dice is half shots, you have a 12.5% chance of getting three shots.

Multiplying the two chances together gets us the probability of pulling 3 red dice and then rolling 3 shots, about 0.044% — incredibly unlikely.

However, this isn’t very useful as you need to decide to continue rolling or not before you know which dice you are going to roll. Instead, it would be useful to know the probability of getting 3+ shots given the dice left in the jar and the number of shots you already have. In other words, calculating the odds of step 1 and step 2 at the same time.

This interaction calculation is not very straight forward and I would argue impossible to do on the fly while playing the game. Instead, many many players just play by intuition and choose to roll the dice.

Photo by el pepe on Unsplash

To roll the dice:

(1) Literally, to roll dice, as for or in a game of chance.

(2) By extension, to take some risk on the hope or chance of a fortunate outcome.

This also happens to be the genius of the game and a big part of what makes it fun. Because the individual probabilities are so straight forward we can leave the complexity to intuition when making game decisions. For example, say you currently have 4x 🧠 and 1x 🔫 and for each of the following game state situations. Which of the three would you feel comfortable going for and choosing to roll again? Which would you pass the dice and take your 4 points? Take a few seconds to think about it.

  • A: A jar containing 1x 💚🎲, 4x 💛💛💛💛🎲, 3x ❤️❤️❤️🎲
  • B: A jar containing 6x 💚💚💚💚💚💚🎲, 2x 💛💛🎲
  • C: A jar containing 3x 💚💚💚🎲, 2x 💛💛🎲, 3x ❤️❤️❤️🎲

While not necessarily knowing the exact probability of striking out in each situation, we all intuitively understand that situation B is the most in our favor and A the least. But what is the actual probability and how different are they? For example, if situations A and B have a 50% and 10% likelihood to strike out respectively my decision to go for it would be very different if instead, chances were 30% and 20% respectively.

In this situation (or any other really), ask yourself “At what chance would you go for it?” Would you go for it with a 50% chance to strike out? 30%? 15%? I encourage you to think about it for a few seconds and make a mental note of your answer before we go over the exact probabilities. Making a claim is the best way to learn.

Doing the “Math” via Simulating probability

While we could calculate the probability of each situation using Bayes Theorem, it’s not very straightforward. Instead, I decided to simulate it in Python.

I started this by creating a class for each of the major game pieces (Dice and Jar) and a few methods that randomly select a dice from a jar and randomly select a side of a dice (aka roll the dice). I then set up my objects in each of the situations described above, “rolled the dice”, and noted the result. Running each of these simulated plays 10,000 times resulted in a good estimate of the actual probability — ah the power of computers! Below is some pseudo-code describing the above, but if you are interested in looking into the code yourself you can find it on my GitHub.

results = []
for i in range(10000): # simulate 10k times
# initiate a jar with situation C
jar = Jar(greens=3, yellows=2, reds=3)

# return n dice at random from the jar
dice = jar.get_dice(n=3)
# roll the 3 dice
result = [die.roll() for die in dice]
results.append(result)

I tested my code by comparing the results against some of the simple situations from before. For the probability of rolling 3 shots from 3 red dice, my simulation resulted in a 12.55% chance (doing the math got us 12.5%). Not exactly the same but very very close.

Setting up my simulation for our 3 situations, I got the following probabilities to get 2 or more shots and strikeout (remember we already had one shot from previous rolls):

  • A: 31.4% to strike out for: 1x 💚🎲, 4x 💛💛💛💛🎲, 3x ❤️❤️❤️🎲
  • B: 11.3% to strike out for: 6x 💚💚💚💚💚💚🎲, 2x 💛💛🎲
  • C: 25.8% to strike out for: 3x 💚💚💚🎲, 2x 💛💛🎲, 3x ❤️❤️❤️🎲

To no one’s surprise, our intuition of the relative ranking of these situations is correct. But are the absolute odds for each surprising? Looking back to the percentage you notated, which situations would you keep rolling on based on probabilities alone?

These numbers surprised me. I personally, would have taken bets B and C but not A in an actual game of Zombie Dice. However, the odds for A and C are not too far off from each other at 31.4% and 25.8% respectively. When it came to my number, I was willing to accept odds 2:1 in my favor or look for a 33% chance of failure or less before I was willing to go for it and sacrifice the 4 points I already collected. Given that, I should have gone for it in each of these situations.

Takeaways

Our intuition of probability is rather good on a relative basis. We often correctly identify when one thing is more likely than another (like when ranking the three scenarios). However, our intuition is not very good when identifying absolute probabilities. We often don’t realize the magnitude of the probability or how to use that number to make decisions.

Of course, this is something that we can practice. By consciously playing games like Zombie Dice or poker, we can learn to better our understanding of probability and convert that into a skill. This is where step 3 comes into play. Skill in games like this is being able to utilize the probability to understand the risk versus reward trade-off and make a better decision.

In the exercise from before I asked what single probability would you feel comfortable going for it (mine was less than 33%), but to be highly skilled at the game you would need to adjust that percentage depending on the situation. For example, if I had 7 brains on the line I may want to play more conservatively and not go for it. Or, if the player I was passing to had 11 points I might want to play more aggressively because I may not get another turn.

Knowing the probabilities just allows us to make a more informed decision, it doesn’t tell us what decision to make.

Thanks for reading. 🎲

--

--