# Calculating 6D6 similar to poker dice [closed]

I keep coming back to the idea of building a game system around a 6D6 roll, taking matching sets of numbers and 'straights' as measures of effect. This guarantees that something always turns up (as the only way to roll no matches is to create a perfect straight). However, I do not have the math skills to work out probabilities to this order of complexity.

I can see that matches and straights would mutually exclude each other to some degree, but I'd want to account for levels of difficulty by setting a minimum level for a pairing/straight to exceed. How do I figure out the probabilities I need?

• Just to check that I've understood correctly, your question is essentially: "Where can I find an online dice program that would allow me to examine the probabilities of my proposed mechanic?" Commented May 30, 2015 at 16:34
• If you want an evaluation here, we need a complete description of the mechanic. If you only want a pointer to a tool that can help you, then that's not clear in the question. Can you clarify which you're asking? Commented May 30, 2015 at 18:17
• Yes, please clarify if you just want a tool or if you want analysis here - though if you want analysis here you'd need more details. Commented May 30, 2015 at 22:59
• Since tool-recommendation questions are considered off-topic nowadays, and since the OP does not seem to be active here any more (last seen in July last year), I've gone ahead and edited out the sentence asking for an online tool (and voted to reopen). Commented Jun 3, 2016 at 16:14
• @IlmariKaronen The description of the mechanic is still too incomplete to be able to answer though. Commented Jun 3, 2016 at 17:28

The general trick to calculating such odds is that the probability of rolling a result that matches some criterion equals the number of possible matching rolls, divided by the total number of possible rolls.

(By "roll", here, we mean a sequence of numbers obtained by rolling a certain number (e.g. 6) of a certain kind of fair dice (e.g. d6) in sequence. The important feature here is that each such roll, by itself, is equally likely, which is why the simple formula above works. If the rolls were not all equally like, we'd have to resort to more complicated maths.)

For 6d6, the total number of possible rolls is $6^6$ = 46,656. (More generally, for NdX, the total number of possible rolls is $X^N$.) Next, we just need to figure out in how many ways we can roll each of the results we're interested in.

## Straights

For example, let's look at straights first. A straight on 6d6 obviously consists of the numbers 1, 2, 3, 4, 5 and 6, in any order. How many ways are there to order them?

Well, imagine that we have six dice, each showing one of the numbers from 1 to 6, and six positions marked 1 to 6 on the table that we want to put the dice in. For the first position, we can choose any of the dice, so we have 6 choices there; for the second position, we only have five dice left, so the number of possible choices we can make for the second die is 5, giving us a total of 6 × 5 = 30 possible choices for the first two dice.

Continuing in this manner, we find that the total number of different orders in which we can set down the six distinct dice is $6 \times 5 \times 4 \times 3 \times 2 \times 1 = 720$. (Mathematicians have a specific name and a notation for such products, because they come up pretty often in math: they call them factorials, and write them by putting an exclamation point after the upper limit, as in 6! = 720.) Thus, the probability of rolling a straight on 6d6 is 6! out of $6^6$, or $720 \div 46,656 \approx 0.0154 = 1.54\%$.

(For straights shorter than 6 dice, things get more complicated; see the computer results below.)

## $n$ of a kind

What about $n$ of a kind? Well, it's pretty obvious that there are exactly six ways to roll 6 of a kind — either all 1, all 2, all 3, all 4, all 5 or all 6. Thus, the probability of rolling six of a kind is $6 \div 6^6 \approx 0.00013 = 0.013\%$. This is just about the rarest kind of combination you can get.

5 of a kind

For five of a kind, we clearly have six choices for the number that occurs five times, and five choices for the single mismatched roll (or vice versa; it really doesn't matter which way you count them, since the result is the same), for a total of $6 \times 5 = 30$ possibilities. But since we're considering ordered die rolls (which we must do, to ensure that every roll is equally likely), we also have six choices for the position of the mismatched die in the sequence, giving us a total of $30 \times 6 = 180$ ways to roll 5-of-a-kind on 6d6, and thus a probability of $180 \div 6^6 \approx 0.00386 = 0.386\%$.

4 of a kind

How about four of a kind? Again, we have six choices for the matched dice, but now there are more possibilities for the mismatched ones. We could consider the cases where the two mismatched dice are the same or different separately, but that quickly gets a bit complicated.

The easy way here is to first assign the two mismatched dice into specific positions in the sequence; we can put the first one in any of 6 positions, and the second in any of the remaining 5, for a total of 30 choices — but, since we haven't yet assigned values for those dice, they're identical, and so we need to divide by 2 to avoid counting identical positions twice (because putting the first mismatched die in position 1, and the second in position 2, gives the same result as putting the first in position 2 and the second in position 1), giving us 15 ways to place the mismatched dice into the sequence of 6 rolls.

Having done that, we just need to pick arbitrary values for those two die rolls; they can be identical, but neither of them can equal the four matched dice, so we have $5 \times 5 = 25$ choices total here. Putting this together with the 6 choices for the matched dice, and the 15 ways of picking the positions of the mismatched dice, and we get $6 \times 15 \times 25 = 2,250$ ways of rolling 4-of-a-kind on 6d6, with a probability of $2,250 \div 6^6 \approx 0.0482 = 4.82\%$, or slightly under one in 20—a lot more likely than 5-of-a-kind.

3 of a kind

We could do the same thing for three-of-a-kind, but that gets even more complicated, mainly because it's now also possible to roll two different sets of three in a single 6d6 roll. Counting the possible combinations, in a similar manner as above, isn't really difficult as such, but it does get tedious and error-prone.

## ...and so on

Fortunately, we can cheat and use a computer! Since there are only about 47 thousand possible 6d6 rolls, a computer can loop through all of them in a fraction of a second, and count how many times the most common die occurs in each of them. We can also do the same for straights, counting the longest sequence of consecutive dice rolled:

Using the dice_pool() helper function (which enumerates all possible sorted outcomes of rolling NdX dice and their respective probabilities) from this answer, here's a simple Python program to calculate the probabilities of various groups and straights:

# generate all possible sorted NdD rolls and their probabilities
# see http://en.wikipedia.org/wiki/Multinomial_distribution for the math
factorial = [1.0]
def dice_pool(n, d):
for i in range(len(factorial), n+1):
factorial.append(factorial[i-1] * i)
nom = factorial[n] / float(d)**n
for roll, den in _dice_pool(n, d):
yield roll, nom / den

def _dice_pool(n, d):
if d > 1:
for i in range(0, n+1):
pair = (d, i)
for roll, den in _dice_pool(n-i, d-1):
yield roll + (pair,), den * factorial[i]
else:
yield ((d, n),), factorial[n]

# the actual calculation and output code starts here
groups = {}
straights = {}
for roll, prob in dice_pool(6, 6):
# find largest n-of-a-kind:
largest = max(count for num, count in roll)
if largest not in groups: groups[largest] = 0.0
groups[largest] += prob

# find longest straight:
longest = length = 0
for num, count in roll:
if count > 0:
length += 1
else:
length = 0
if longest < length: longest = length
if longest not in straights: straights[longest] = 0.0
straights[longest] += prob

# print out results
for n in groups:
print("max %d of a kind: %9.6f%%" % (n, 100*groups[n]))

for n in straights:
print("max %d in a row: %9.6f%%" % (n, 100*straights[n]))


And here's the output:

max 1 of a kind:  1.543210%
max 2 of a kind: 61.728395%
max 3 of a kind: 31.507202%
max 4 of a kind:  4.822531%
max 5 of a kind:  0.385802%
max 6 of a kind:  0.012860%

max 1 in a row:  5.971365%
max 2 in a row: 34.615055%
max 3 in a row: 32.407407%
max 4 in a row: 17.746914%
max 5 in a row:  7.716049%
max 6 in a row:  1.543210%


Note that this output doesn't distinguish e.g. two or three pairs from a single pair, or a triple and a pair from just a triple. If you know some Python, it would not be difficult to modify the program to check for those as well.

Also note that it's actually really hard to get no more than one die of each kind (since that actually requires rolling a perfect straight), and also pretty hard to get no more than one in a row (although still a lot easier than getting six of a kind, since e.g. rolling 1,1,3,3,5,5 also counts). Three in a row is also only slightly less likely than two in a row (although some of the rolls counted as three in a row by the program actually include both), but larger groups and straights show the expected downward trend in probability as the group size increases.

• Huh, that's weird... I'm not sure how I was able to post this answer, given that the question was closed while I was writing it. Anyway, does it answer your question, or is there something else you'd like to see clarified? Commented May 30, 2015 at 19:45
• You might want to clarify that you're not counting straights if there are any matches 2 and up. It's possible to have a straight that's 3, 4, or 5 long with scattered matches in the rest. Commented Jun 3, 2016 at 17:30
• @TuggyNE: I'm not actually counting straights shorter than 6 dice at all in the answer above. Commented Jun 3, 2016 at 17:45
• That's what I said, isn't it? But I do think you should, because they can exist. Commented Jun 3, 2016 at 17:47
• @TuggyNE: Done. I also added some example Python code, based on a helper function I posted earlier. Commented Jun 3, 2016 at 18:28