## So I Felt Like Solving Zombie Dice

 There is a party game called Zombie Dice where you roll dice and try to get as many points as you can without losing all of your health and dying. Green dice make points more likely than death, red dice make death more likely than points and yellow dice are neutral. I played it with some friends awhile ago and realized that it was probably simple enough for me to come up with the optimal strategy.

Just about every game is solvable in principle, but it is very easy to make a game that would take longer than the age of the universe to solve. The prototypical solved game is tic-tac-toe. The prototypical game that is still a long way from being solved is chess. An xkcd comic lists a bunch of solved games so let's see how we can add Zombie Dice to this list.

Now the rules of Zombie Dice are that you have a cup containing 13 dice and on your turn, you randomly choose dice to roll. You always roll three at a time and you can keep doing this until you die, run out of dice or choose to pass the cup on to the next person. There are three icons that can be rolled:

• Brains: Each brain is a point. The possibility of more brains would encourage a person to keep rolling. Green dice have three, yellow have two and red have one.
• Shotguns: Shotgun blasts lower your health by one, and if three of them are encountered in a turn, the turn ends with 0 points. The possibility of more shotguns would discourage one from continuing to roll. Green dice have one, yellow have two and red have three.
• Walkers: Denoted by footprints, this result means that the die will be included in the next roll if you choose to roll again. Instead of drawing three new dice, you draw three minus the number of walkers from the last roll. All dice have two of these.

The cup begins with 6 green dice, 4 yellow dice and 3 red dice. The first player to get 13 points wins. This can be done in one turn but the probability is about one in a million. The need for some basic strategy is clear. You could end up with three green dice for your first roll and then roll them and get a lot of brains, which is good. But this makes the second roll more risky. The fact that three green dice have been used up means that the next dice are more likely to be yellow and red which increase your chances of being shot. This uncertainty about whether to roll is part of the fun of the game. It can be surmounted by using a formula for the expected number of points . When deciding whether to continue, a player should roll if and cash in if .

The game state is a function of a few different variables. First, you need to know how many green dice are left , how many yellow dice are left and how many red dice are left . You also need to know your health and the number of points you already have . Also dictating the state of the game are the number of walkers you have and the colours of the dice on which they appear. The initial condition is , , , and with no walkers.

If a player rolls three walkers, the following roll would just be a re-roll so in this case

Rolling two walkers on the other hand, requires the player to draw one die. This can either be a green, a yellow or a red die so there are three expectation values to consider. Moreover they must be weighted by the probability that the given die will be drawn so the overall expected number of points is

where in the last step I have written in the expressions for how likely it is that a given die will be drawn. With one walker, there are two dice to be drawn leading to a weighted sum of six conditional expectations:

With no walkers and no dice pre-determined, we get ten terms in the sum:

Once we know the ten expected values, these four expressions allow us to plug in the game state and always know whether it makes sense to keep betting or fold. The expectations are tedious to calculate but I didn't come this far to back down now! Here is a list of them:

As an example I will repeat one of the calculations here. How about , the one with three red dice. Whenever you begin a roll with points, there are five possibilities for the number of points you will have at the end of the roll: , , , or . One definite thing we can say is that because in order to get three points, we need to roll three brains in a row. Every other probability depends on what the health is. First, let's solve for them when the player has three health.

because in order to die and lose all your points, you would have to roll three shotgun blasts in a row. In order to gain or lose no points, you have to roll three non-brains without dying.

The first product is the probability for rolling three non-brains in a row. This counts the possibility of three shotguns however which is why we subtract one eighth.

If we want one additional point, we are rolling one brain and two non-brains. We multiply by three because any one of the three red dice could've been the one that was a brain.

For two additional points, we do the same thing except it's two brains and one non-brain. Plugging these into the formula for expected value,

Moving on to two health,

we get an extra term in the probability of dying compared to three health. We could roll the three shotgun outcome from our last calculation but we also need to count the three ways of rolling two shotguns and one non-shotgun.

Here, the first term is the probability of three walkers and the second is the probability of two walkers and a shotgun.

This is brain-walker-walker plus brain-walker-shotgun. The six is there because there are six permutations we can apply to the three different values.

This one is brain-brain-walker plus brain-brain-shotgun. Now we can plug these in again to get

Notice that this roll puts you at a disadvantage unless you have zero points and nothing to lose. This is in contrast to the same roll at three health where you need to have four points before the roll becomes too dangerous. Now to deal with the case of one health,

Everything but three non-shotguns leads to death so we simply subtract this probability from unity.

For this one, a single shotgun would kill us and a single brain would give us a point, so it's walker-walker-walker.

This has to be brain-walker-walker for the same reason.

Similarly, this is brain-brain-walker. Now to plug in these numbers one more time,

Now we have three equations but we want to combine them into one that looks like . This is just a cheap trick so we will choose quadratics , . The requirements , , , , and reduce this to a system of linear equations. Solving them, we get and . Of the ten tedious functions of and , this gives us the seventh one. The others are all obtained in similar ways.

Clearly by taking your first roll, you can only gain points or stay the same. Subsequent rolls only happen if you stand to benefit from them. Therefore a turn will give a player more than zero points on average. In other words, the game will almost surely end. A harder calculation would tell you how many turns this is likely to take. This is the same as asking what the expectation is for the number of points that can be accumulated in a single turn if this optimal strategy is used from start to finish. In fact one could get the entire distribution for the number of points accumulated. This is mainly hard because of the walkers. The events of rolling a certain outcome and choosing a certain set of dice for the next roll are not independent. Maybe we should simulate this. Sorry for switching between first, second and third person so often.

### You haven't solved zombie

You haven't solved zombie dice, you've calculated the expected value of any decision.

An optimal player is going to take more risky moves if other players are ahead (given that it's a race to 13 points), even if that decision has a lower EV.

Likewise, a winning player might make a lower-EV decision if it means solidifying their lead.

### You're completely right.

You're completely right. Finding the right strategy is only as simple as I made it seem if you are blind to everyone else's progress.