Wednesday, January 4, 2017

D&D Stat Roles

If you have played any incarnation of D&D, you are no doubt familiar with the ritual of generating the vital statistics defining your character:

  • take four D6s, roll them, throw away the lowest one, and sum up the remaining three
  • repeat the above five more times, giving six numbers
  • assign these numbers among strength, fortitude, dexterity, intelligence, wisdom, and charisma

In this post, we will examine the question: what are the odds of a given stat number being rolled?

The answer is trivial to produce for a competent programmer, and is as follows:

Stat rollOdds
3 1 in 1296
4 4 in 1296
5 10 in 1296
6 21 in 1296
7 38 in 1296
8 62 in 1296
9 91 in 1296
10122 in 1296
11148 in 1296
12167 in 1296
13172 in 1296
14160 in 1296
15131 in 1296
16 94 in 1296
17 54 in 1296
18 21 in 1296

This isn't a very satisfying answer, though. Why is the table the shape that it is? Compare the table above to the following table, which is the odds of 3D6 summing to a given number, with no throwing away of any dice:

Stat rollOdds
3 6 in 1296
4 18 in 1296
5 36 in 1296
6 60 in 1296
7 90 in 1296
8126 in 1296
9150 in 1296
10162 in 1296
11162 in 1296
12150 in 1296
13126 in 1296
14 90 in 1296
15 60 in 1296
16 36 in 1296
17 18 in 1296
18 6 in 1296

The distribution for 4D6 with a dropped die is more complex because the final sum depends critically on which die is the lowest (and thus thrown away), but the odds that a given die is the lowest is dependent on the value rolled on the other three dice.

To be specific: say you rolled the first die, and it came up a 1. In this case, you would know that this was the lowest roll, and could consider the odds of the final sum assuming that that die was thrown away. If the first die rolled a 6, you would know that this was NOT the lowest roll (at the worst it was tied), and could keep it, and odds of the final sum could be the odds of 3D6 were rolled, and one was thrown away, and you added six to that total. If, however, the first die was any other number, you really don't know very much. You have to roll the others to see.

To make headway on our problem, we need to separate these dependencies into a set of disjoint, indepenent possibilities. We do so by observing two facts:

  • For any 4D6 roll, exactly one is true: the first die is lowest, the second die is lowest, the third die is lowest, or the fourth die is lowest
  • For any 4D6 roll, exactly one is true: the lowest die is a 1, the lowest die is a 2, the lowest die is a 3, …, or the lowest die is a 6

One more fact is required, to handle the case where the lowest number is rolled more than once (for example the roll {3,1,1,6}). In such a case, the lowest die is the first one with the given lowest roll.

Convince yourself that every 4D6 roll will fall into one of these 24 buckets:

Lowest rollLowest die
1st2nd3rd4th
1
2
3
4
5
6

Let us begin to fill in the table:

  • What are the odds that the lowest roll is a 6?
    • Clearly, this will only happen if all four dice roll 6, and this can only occur once.
  • What are the odds that the lowest roll is a 5?
    • This occurs if all four dice roll 5 or 6, which can occur 2^4 = 16 times. However, we must subtract one, since we have double-counted the case where all four dice roll 6.
  • What are the odds that the lowest roll is a 4?
    • By a similar argument, this will be 3^4 - 2^4 = 65
We continue this line of reasoning, and are able to conclude that:
Lowest rollLowest dieRow sum
1st2nd3rd4th
1671
2369
3175
465
515
61

We don't yet know what is in each bucket, but we can sum the rows of the buckets.

Now, consider the case where the lowest roll is a 1:

  • What are the odds that it is the first die that rolls 1?
    • To do this, the first die must roll 1, and then the other three dice rolls can be anything. They thus fit the pattern [1][*][*][*] (where * denotes 'any'). This has 1*6*6*6=216 occurrences.
  • What are the odds that it is the second die that rolls 1?
    • Recall the rule that the lowest die is the first with a given value. For the second die to be the lowest, and have rolled 1, the first die cannot roll 1. We thus have the pattern [2+][1][*][*], which has 5*1*6*6=180 occurrences.
  • What are the odds that it is the third die that rolls 1?
    • By a similar argument, rolls of this type fit the pattern [2+][2+][1][*], which has 5*5*1*6=150 occurrences.
  • What are the odds that it is the fourth die that rolls 1?
    • By a similar argument, rolls of this type fit the pattern [2+][2+][2+][1], which has 5*5*5*1=125 occurrences.

As a check of our reasoning, observe that 216+180+150+125=671. We can thus fill in the table as follows:

Lowest rollLowest dieRow sum
1st2nd3rd4th
1 [1][*][*][*] (216) [2+][1][*][*] (180) [2+][2+][1][*] (150)[2+][2+][2+][1] (125)671
2[2][2+][2+][2+] (125)[3+][2][2+][2+] (100)[3+][3+][2][2+] (80)[3+][3+][3+][2] (64)369
3[3][3+][3+][3+] (64)[4+][3][3+][3+] (48)[4+][4+][3][3+] (36)[4+][4+][4+][3] (27)175
4[4][4+][4+][4+] (27)[5+][4][4+][4+] (18)[5+][5+][4][4+] (12)[5+][5+][5+][4] (8) 65
5[5][5+][5+][5+] (8) [6][5][5+][5+] (4) [6][6][5][5+] (2) [6][6][6][5] (1) 15
6 [6][6][6][6] (1) 1

Note that the tiebreaking rule results in three of the buckets being empty.

"So what?" I hear you now ask. "You have taken one number and split it into the sum of twenty-one different numbers. How does this help?" I respond by first noting that the identity we have discovered is not at all obvious, and can be admired in its own right:

6*6*6 + 6*6*5 + 6*5*5 + 5*5*5 + 5*5*5 + 5*5*4 + 5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 6*6*6*6
        6*6*5 + 6*5*5 + 5*5*5 + 5*5*5 + 5*5*4 + 5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 6*6*6*5
                6*5*5 + 5*5*5 + 5*5*5 + 5*5*4 + 5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 6*6*5*5
                        5*5*5 + 5*5*5 + 5*5*4 + 5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 6*5*5*5
                                5*5*5 + 5*5*4 + 5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 5*5*5*5
                                        5*5*4 + 5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 5*5*5*4
                                                5*4*4 + 4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 5*5*4*4
                                                        4*4*4 + 4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 5*4*4*4
                                                                4*4*4 + 4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 4*4*4*4
                                                                        4*4*3 + 4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 4*4*4*3
                                                                                4*3*3 + 3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 4*4*3*3
                                                                                        3*3*3 + 3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 4*3*3*3
                                                                                                3*3*3 + 3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 3*3*3*3
                                                                                                        3*3*2 + 3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 3*3*3*2
                                                                                                                3*2*2 + 2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 3*3*2*2
                                                                                                                        2*2*2 + 2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 3*2*2*2
                                                                                                                                2*2*2 + 2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 2*2*2*2
                                                                                                                                        2*2*1 + 2*1*1 + 1*1*1 + 1*1*1 = 2*2*2*1
                                                                                                                                                2*1*1 + 1*1*1 + 1*1*1 = 2*2*1*1
                                                                                                                                                        1*1*1 + 1*1*1 = 2*1*1*1
                                                                                                                                                                1*1*1 = 1*1*1*1

The key point of the table, though, is that in all cases we have identified (and thus are able to discard) the lowest die. We can compute the odds of a given number being rolled directly from the remaining three dice.

Let us compute that table:

Lowest
value
Lowest
die
34 5 6 7 8 9 10 11 12 13 14 15161718
1 1st 13 610152125 27 27 25 21 15 10 6 3 1
1 2nd 1 3 6101520 23 24 23 20 15 10 6 3 1
1 3rd 1 3 61015 19 21 21 19 15 10 6 3 1
1 4th 1 3 610 15 18 19 18 15 10 6 3 1
2 1st 1 3 610 15 18 19 18 15 10 6 3 1
2 2nd 1 3 6 10 14 16 16 14 10 6 3 1
2 3rd 1 3 6 10 13 14 13 10 6 3 1
2 4th 1 3 6 10 12 12 10 6 3 1
3 1st 1 3 6 10 12 12 10 6 3 1
3 2nd 1 3 6 9 10 9 6 3 1
3 3rd 1 3 6 8 8 6 3 1
3 4th 1 3 6 7 6 3 1
4 1st 1 3 6 7 6 3 1
4 2nd 1 3 5 5 3 1
4 3rd 1 3 4 3 1
4 4th 1 3 3 1
5 1st 1 3 3 1
5 2nd 1 2 1
5 3rd 1 1
5 4th 1
6 1st 1
SUM 141021386291122148167172160131945421

Now that is a satisfying answer.

No comments:

Post a Comment