Table of Contents

Wednesday, 3 January 2018

What's the probability xD6 beats yD6?

What's the probability a roll of xD6 beats yD6? In other words, roll x number of D6's, add them all up, and compare to the sum of rolling a number of y D6's. I got this exact question from a long-time gaming friend some time ago.

My first question was "How large are x and y?" With small numbers, one could do the calculation by hand, but with larger numbers, finding a closed-form formula might be more difficult. "Anything from 1 to 12", was the answer.

What's the distribution of xD6?

The first thing to consider is the probability distribution of the sum of rolling x number of D6's. Most gamers know that the distribution of outcomes for a single D6 equals {1, 2, 3, 4,5 ,6}, with all outcomes having a 1/6 probability of occuring. But what is the distribution of adding multiple D6's together?

In mathematics, this is known as a convolution operator. Simply stated, a convolution adds distributions together, arriving at a final distribution that reflects the sum of various independent variables. We will not go into the mathematics of computing such convolutions for die rolls, but most wargamers are familiar with the notion that the more dice you roll and add together, the more the final result behaves like a "bell curve" (although I always like to point out that a bell curve has a precise mathematical definition, being the Gaussian normal distribution, but let's not start that discussion here :-)).

The plot below shows the resulting probability distributions for rolling 2D6, 4D6, ... , 12D6 (using the excellent tool As you can see, the more dice you roll, the more spread out the results become (varying between rolling all 1's or all 6's), but there's a clear "bulge" in the middle of the distribution that indicates a higher probability for those particular results. Also note that these are discrete distributions, i.e. only the dots are possible outcomes. The lines between the dots are only drawn for a nicer visualization.

Comparing xD6 to yD6

When we want to compute the probability that xD6 beats yD6, we need to consider all possible results of xD6, and compare to them all possible lower results of yD6. All combined probabilities of such combinations need to be added to arrive at the final probability.

We can illustrate this process on the graph below. The distributions for 6D6 and 10D6 are shown. Let's single out the probability that 6D6 gives 28 as a result. We now need to multiply this probability (2.5%) with all probabilities that 10D6 gives a lower result, and add them all up. Then we need to repeat the process for all other outcomes of the 6D6 roll as well.

 Especially for high numbers of x and y, this can result in quite some tedious calculations, so perhaps there is an easier way?

What's the distribution of xD6 -yD6?

What we really want to compute when comparing xD6 to yD6 is the probability that xD6 - yD6 gives us a number greater than 0. This means subtracting two distributions, which is itself a convolution operator.

But we can do something clever here. The distribution of a single D6 is exactly the same as the distribution of 7-D6 (see also "D20 = 21 - D20?").

Thus, yD6 has an identical distribution of 7y-yD6, and so we can say that:

probability xD6 - yD6 > 0
probability xD6 + yD6 -7y > 0
probability (x+y)D6 > 7y

Let's illustrate this using x = 6 and y = 8. The graph below shows that 6D6-8D6 has exactly the same distribution as 14D6, except it is shifted by a distance of 7*8 = 56.  The probability that 6D6 - 8D6 is greater than 0, is the same probability that 14D6 is greater than 56.

What's the probability that zD6 > some number?

So, we need to compute the probability that any distribution zD6 is larger than some number (which itself is a multiple of 7). Can we do that?

It is difficult to find a closed-form solution for this probability. It can be done, but the mathematics involved would fall outside the scope of this article. An alternative could be to approximate zD6 with a Gaussian distribution with the proper mean and deviation, and compute the integral under part of the Gaussian curve ... which involves the so-called erf or error function and is a built-in function in many numerical mathematical packages. But again, this would fall outside the scope of some simple game design calculations. And moreover, such approximation would only hold for large numbers of z.

So, what do we do?

In the end, I fear there's not much we can do than to simulate a large number of die rolls, and compute the probabilities as an average of all these simulations. You can quickly program something like that, using a proper programming language, or even something like MS Excel.

I have done exactly that, and the table below gives the final results ...

The color codings indicate the percentages: 10% and 40% intervals on both sides, and anything below 1% in grey. Draws are not included in the percentages, so that's why 2D6 only has a 44.5% probability of beating another 2D6.

But what about using this as a gaming mechanic?

The mathematics above say nothing about the elegance or usefulness of comparing xD6 to yD6 as a gaming mechanic. I fear this is where everything falls apart. It seems to me that comparing die rolls like this is quite some hassle. You need to roll multiple dice, compute the sum, and compare it to another sum. That's a lot of work for a binary decision. On the positive side, modifiers can easily be included by increasing or decreasing the number of dice.

Moreover, from the table above one can see that the "workable" range of probabilities (yellow and orange areas) is quite limited. So, although x and y vary from 1 to 12, they better do not deviate too much in order not to have a foregone conclusion.

My conclusion?

I would not recommend comparing xD6 to yD6 as a gaming mechanic ... I still prefer using single polyhedral dice for opposed die rolling.

No comments:

Post a Comment