A Mathematical Analysis of Exploding Dice March 22, 2009

I’m guessing the title caught your eye? I wrote this essay a while back, but decided to hold off on posting it until I had my power cord back. So… here we go:

With a normal die roll, the result is either 1, 2, 3, 4, 5, or 6. This will later be generalized to N-sided dice, but for now, the standard six-sided variety will suffice. Some games (dice-based tactics games, usually) use a system called “exploding dice.” With this system, rolling the maximum value on a die allows the roller to roll the die again and add the new result to the previous one. There is usually no limit on the number of rerolls.

For example, a player rolls a six. He rerolls the die, which lands on six once again. Once more, he rolls, but this time gets a two. His final result for this roll is effectively fourteen, even though the die has only six faces .

Put simply, expected value is what the average result for an experiment would be if were tried an infinite number of times. For example, if a coin flip was worth one point if heads lands and two points for tails, the expected value would be 1.5 since heads and tails are equally likely.

To compute expected value, the sum of each possibility times its respective chance is taken. For the coin flip example, this would be . That is, a 50% chance of 1 point plus a 50% chance of 2 points.

So the problem to be tackled here today is this: how does the expected value of an exploding die differ from its standard expected value?

The first step will be to find a pattern. Here is a quick comparison of values and their respective probabilities:

So how can these be put into an elegant formula? First of all, a simple sum of products will be used:

The factors preceeding each sum are powers of six, so they can be consolidated into a nested sum:

Each sum, such as , is equal to the average value times the number of elements. The number of elements remains a constant 5, but the average value is increased by 6 for each subsequent sum, beginning with a value of 3. The formula can now be rewritten like so:

Simplifying some of the products, the formula can be rewritten once again:

Now an obvious pattern begins to develop. By expanding these nested products, the pattern becomes even more clear:

Six is factored out of all terms:

This new formula can be rewritten in sumation notation:

For each term added, our error will be reduced by a factor of 6, so just a few terms will return a very accurate result:

The sum is swiftly approaching exactly 4.2, but what is the relation of that value to a six-sided die’s normally expected value?

Adding the exploding modifier to a six-sided die changes its expected value by a factor of . That is, the ratio of the number of sides on the die to the number of sides that do not “explode.”

I have performed the same calculations on four and eight-sided dice to compare results, and the forumla holds.

For any N-sided die numbered 1 to N with all sides equally likely, the exploding modifier will increase the die’s expected value by a factor of .

Interestingly enough, this formala holds for a hypothetical one-sided die. Heuristically, since the highest number will always be rolled, the total will constantly increase, returning an infinite result. Mathematically, the expected value of 1 will increase by a factor of , which approaches positive infinity from positive values.

This essay was written by Eric Dobbs, an undergraduate student of computer science at the University of Tennessee, Knoxville. He can be reached at erictdobbs -at- gmail -dot- com.

Advertisements

Like this:

LikeLoading...

Related

The Pathfinder Chronicles campaign setting sets some heavy restrictions on the user of firearms, what with chances to misfire, the need to have a special feat, penalties for different sized creatures and an obscene entry cost. The fact that these weapons do exploding damage might make up for this, but by this analysis, it doesn’t look like much of a difference.

But, a player might object, despite the vanishingly small probability at each iteration, there is at least some chance of blowing away a dragon with one shot. Okay. Well, in order to make an informed decision about that we would need to know for one thing what the chances even are of doing more than the maximum of the same damage roll that doesn’t explode. Is there a way to calculate that, or to calculate an expected maximum value?

There’s a simple way to determine just how easily the result can explode. For a d6, you have a one in six chance of getting anything greater than 6; if you roll a natural six (one in six chance), you’ll add another roll.

The chance of it exploding a second time is a further one in six, so the chance of rolling higher than 12 is one in six to the second power, or one in thirty-six.

[…] then I had the brilliant idea of searching on the Internet. And I found Eric, who did an actual math analysis of exploding dice. Much better than my feeble attempt. I almost wanted to tear up all my calculations in shame. His […]

In the hope the author is still active…I have a question on the subject, how if the system your playing is built so that you if you roll a 6 have to pick it up, add another die and roll them together and if any of them is a six you do the same thing over, then the value of the two die could be lower than your first six, how would you calculate the average result of rolling 3 dices then? I myself calculated it to 10,66666 but i’m sceptical beacuse it’s very close to the “normal” average of 10,5.

If I’m reading your post right, the idea is that the player starts by rolling one die. If a six is rolled, the player discards the result and rolls two dice. If either of them is a six, the player discards that total and tries again with three, and so on.

Am I on the right track? I’ll see if I can come up with an answer sometime in the next bit, but let me know if you had some other system in mind for how this works.

Yes it’s how it works, the number of dice you throw in the beginning is based on the difficulty of the task but the normal is 3D6. And like you say if you roll a six you pick it up and roll 2 dice and so on.

But i guess the simpliest is to calculate for one dice and multiply that with 3. Thx for the help 🙂

Dice still “exploded” on rolls of six but in addition, all 1’s were rerolled but not tallied towards the sum of the roll. Specifically I’m thinking of 4E’s “Brutal” mechanic.

For example, a player rolls a six. He rerolls the die, which lands on six once again. Once more, he rolls, but this time gets a one. He then rolls again getting a two. His final result being fourteen (6+6+2) not counting the 1 which is a reroll but does not count towards the sum.

With 1s not being counted, you essentially have each die roll being from 2 to 6, rather than 1 to 6. So it’s like using a five-sided die, but adding the total number of rolls made to the sum. It would take a little number-crunching, but shouldn’t be too difficult to figure out what the expected value of that system would be.

I may go through that problem in more detail if time permits in the near future. Thanks for the comment!

1) Uncancelled fudge positives explode. The probabilities for -4,-3,-2,-1, and zero should remain unchanged right? What about the right hand side of the distribution?

2) All positives explode. I don’t have any intuition as to what would happen.

I am interested in modifying Fudge to be unbound on the top end. I like the distribution being zero centered and bound on the lower end but want to skew the normal distribution to be more like a gamma distribution.

On 1), the probabilities for some values seem like they’ll be the same, but zero becomes MORE likely. Consider getting -1, +1, +1, and +1. Your net value of 2 means 2 exploding dice, and a 1/3 ^ 2 chance of dropping back down to zero! (This is assuming I understand how this system works; I read through it pretty quickly and think I have the idea of it).

For 2), I _think_ it wouldn’t change anything on the expected value. Regardless of which numbers explode, this system has an expected value of zero. Even with positive values exploding, you have a chance of getting negatives just as easily. Granted, this does mean you have a slim chance of getting high positives, but you also have a higher chance for dropping your value a little bit.

Ah, I wish I had more time to crunch the numbers on this, and look into the exact values for 1)… Sorry I can’t give you a more though-out answer than that right now, but thanks for the question!

def reroll(seed):
roll=randint(-1,1)
if roll==1: seed=reroll(seed+roll)
return(seed)
y=[(randint(-1,1),randint(-1,1),randint(-1,1),randint(-1,1)) for i in range(1000000)]
z=dict((x,0) for x in range(-5,20))
for quartet in y:
current=sum(quartet)
for i in quartet:
if i == 1: current=current+reroll(0)
try: z[current]+=1
except: pass
summer=0
for i in range(-5,20):
print(i,’ >> ‘, z[i])
summer+=i*z[i]
print(‘mean = ‘,summer/1000000)

Thanks! This is great for determining the average, but how can you help me even further by telling me how I can use this (or other some other smarter-than-me-math) to determine the probability of a specific sum (or more) being rolled for a given dice pool of exploding dice? We know six exploding d4 will result in a sum of 20+ more often than four d6, but how can I determine the specific probability? Ultimately I’d like to be able to map these probabilities and compare them against different targets and numbers of dice in the pool so as to better understand the impact and effectiveness of lowering the target or adding a die (and vice versa).

What about systems that use successes, rather than numerical value? For example, 1-3 are failures, and 4-6 are successes. On a 6, you get to roll another dice, with the possibility of more successes, or even more 6’s.

(EDIT) I think I misinterpreted how to tally successes. Modified calculations in the next comment down.

Let’s see…

In any roll of 1d6, you have a 3/6 chance of no success, 1/6 chance of 4 successes, 1/6 chance of 5 successes, and a 1/6 chance of 6 successes PLUS another roll’s worth of successes. So let x be the expected number of successes from a single roll.

For comparison, without the exploding modifier, this rule set gives us an expected value of 15/6. And… hmm. Interesting! It still has the same modifier that a typical exploding die does! The expected value goes up by a factor of 6/5, or the ratio of sides to non-exploding sides.

Hello, Eric, and thank you for a very interesting article. Your conclusion makes it so much easier for me as a game master / dungeon master / guy-who-kills-player-characters to pick the nastiest weapons for my monsters, so now the bosses will feel all the more horrible. Thank you, again!
I have two questions for you, both on exploding dice, if I may.
1) In Hackmaster, they are called penetrating dice, and the rule is that any maximum rolled die gets rerolled, adding it’s total to the score with 1 subtracted every time the die is rerolled. So a d4p (four-sided penetrating die) yielding results of 4, 4, 4 and 2, is mechanically a single roll of a four-sided die yielding 11 (because 4 + (4 − 1) + (4 − 1) + (2 − 1) = 4 + 3 + 3 + 1 = 11). How can this change in how the ‘explosion’ works be factored into your formula? (i.e. _expected value = n + (n ÷ (n − 1))_)
2) Another novelty in Hackmaster, is that thieves get to roll for penetration if they are using their special weapons on the maximum _and_ the maximum minus 1. Using a d4p as example, a thief’s damage roll of 4, 3, 3, 4, 3, 2 would be a single die roll (threes and fours penetrating) resulting in 14 (since 1 is subtracted from all penetration rolls but the first). If using a d6p, the same thief would get penetrating rolls on fives and sixes. How could this be factored into your formula?

I don’t have time to actually figure this out, so I ran a Monte-Carlo simulation to get the results. For each Hackmaster set-up, I ran one million iterations on d4 – d12, then found a formula to express the results.

I don’t mind at all if you want to use this in your blog. Hopefully you can put this to good use in your game; exploding modifiers on enemy attacks can make damage seem a lot scarier, even if it’s just on a d4.

Sorry for hogging this post, but your version of the exploding die in your answer above had me wondering whether I am mistaken or you had a typo. You wrote in your post that ‘For any N-sided die numbered 1 to N with all sides equally likely, the exploding modifier will increase the die’s expected value by a factor of [n ÷ (n − 1)].’ A standard die yields an average of ((n + 1) ÷ 2). Wouldn’t an _increase_ mean to _add_? In other words,
regular exploded n-sided die = regular die average + increase = ((n + 1) ÷ 2) + (n ÷ (n − 1))

If I am wrong, please explain why, as my algebra skills have …waned through lack of use. In advance, thank you for your kind replies.

So i have a question
What if i have a system that counts 4-6 as a success and a 3 and below as a failure, with 6 exploding endlessly as long as 6s are rolled , how would i calculate the probability of a number of successes on a given a number of dice?

A physicist friend of mine gave me the mathematical proof I need to answer that some time in October 2014; I can try to dig out the answer and provide the method. The method provided by Eric22222 works well enough, but is slightly inprecise.

Since any 6’s rolled are already successes, the exploding mechanic has no impact on success or failure: you have a 50% chance to succeed or fail per die- all the explosions do is make some successes bigger than others. Expected number of successes will be number of dice / 2.