Dear Uncle Colin,

I’m playing a solo D&D game and want some strategy advice for the final battle, which consists of a series of rounds, alternating between monster attacks and my attacks. In a monster attack, it rolls nine dice and I roll eight; if it rolls more sixes than I do, I lose the difference in health points. In my attack, I roll three dice and it rolls nine; if I roll more sixes than it does, I win. How many health points to I need to have a 50-50 chance of winning?

- Many Orcs Need Swords To Exact Revenge

Hi, MONSTER, and thanks for your message!

My first thought is, yuk. Those probabilities are going to be a bit hairy, especially for the monster attacks. Let’s look at your attacks first.

You win if:

• You roll three sixes and the monster rolls two or fewer
• You roll two sixes and the monster rolls one or none
• You roll one six and the monster rolls none.

The probability of the monster rolling:

• two sixes is $\nCr{9}{2} \br{\frac{1}{6}}^2 \br{\frac{5}{6}}^7 \approx 0.279$ (call that $S_2$).
• one six is $\nCr{9}{1} \br{\frac{1}{6}} \br{\frac{5}{6}}^8 \approx 0.349$ (call that $S_1$).
• no sixes is $\br{\frac{5}{6}}^9 \approx 0.194$ (call that $S_0$).

The probability of you rolling:

• three sixes is $\frac{1}{216} \approx 0.00463$
• two sixes is $\nCr{3}{2} \br{\frac{1}{6}}^2\br{\frac{5}{6}} \approx 0.0694$
• one six is $\nCr{3}{1} \br{\frac{1}{6}}\br{\frac{5}{6}}^2 \approx 0.347$.

So the probability of you winning a round is $\frac{1}{216}(S_0+S_1+S_2) + \frac{15}{216}(S_0+S_1) + \frac{75}{216}(S_0)$, which works out to be about 0.1088 – you’ll win about one round in 10.

### The monster’s attacks

Honestly, we could do the same analysis, but we’re not going to. Instead, we’re going to work it out with a generating function.

Skipping a lot of details, we can model the number of sixes the monster rolls as $\br{\frac{5}{6} + \frac{1}{6}x}^9$, and the number of sixes you roll as $\br{\frac{5}{6} + \frac{1}{6}y}^8$.

And in fact, if we let $y = {x^{-1}}$, then multiplying those two expressions together gives us magic ((Not a spell you can cast, sadly)): the coefficient of the $x^k$ term is exactly the probability of the monster rolling $k$ more sixes than you.

Unfortunately, it’s - so to speak - monstrous. Neglecting the terms with non-positive powers of $x$ gives a generating function of $\frac{390625}{16926659444736} x^9 + \frac{18203125}{16926659444736}x^8 + \frac{47515625}{2115832430592}x^7 + \frac{585490625}{2115832430592}x^6 + \frac{9431471875}{4231664861184}x^5 + \frac{51945142375}{4231664861184}x^4 + \frac{99389922275}{2115832430592}x^3 + \frac{263182236755}{2115832430592}x^2 + \frac{1888873979963}{8463329722368}x$

Frankly, we’re in simulation territory here. There is an analytic solution, but just no.

Running a few thousand simulations (which we could, of course, have done straight away) shows that with 4 health points, you win 44% of the time and with 5, you win 52% – so five health points will be enough about half of the time. With nine, you win about three-quarters of the simulations, and with 16 you have a 90% success rate.

Hope that helps!

- Uncle Colin