# Help Calculating Dice Odds for a Unique d6 Dice Pool

I'm attempting to design a unique d6 dice pool system, and I want to try programming the probabilities in AnyDice but I'm not sure how. Here's how the system works:

• Dice pools are between 2 and 10 dice
• A roll of 5 or 6 is a success
• Any dice that sum to 5 or higher also count as successes

For example, a roll of (6,3,2,3,5,4,3,1) would be 5 successes (1 from 6, 1 from 5, 1 from 3+2, 1 from 4+1, and 1 from 3+3).

What kind of program in AnyDice or Excel would I use to calculate average odds for each dice pool up to 10 dice?

• What kinds of probability are you interested in? I posted an answer with the simple average, but if you also need something like, %chance of X size pool reaching Y successes, that should also be possible. Nov 28, 2014 at 19:26
• What I'm looking for is both average roll for a dice pool and a percentage chance of X successes for Y dice pool as well. Nov 28, 2014 at 21:02
• I think this might be a bit out of our league, then. Or at least mine. Perhaps this would be a better question for stats.se. Nov 28, 2014 at 21:09
• I've been doing a little more analysis myself, and I think that the combinations on multiple dice that I need to look for are in no particular order: 1+4, 2+3, 2+4, 3+3, 3+4, 4+4, 1+1+3, 1+2+2, 1+1+1+2, and 1+1+1+1+1. Am I right in that each die would be about 0.51 successes? Nov 28, 2014 at 21:32

An exhaustive generation of the possibilities can be done.

It is not 100% clear what you mean by "dice totalling at least 5", I've chosen to interpret this as "sum up to 5 dice" and that means one would have at least one success with a pool of 5 or more dice (and at least 2 successes with a pool of 10 dice).

In principle, the algorithm is simple:

# interpret "roll a die" as "loop from 1 to 6 and for each..."
declare a tabulation function
declare a "generate all rolls" function, taking dice to roll and rolls so far
if we should roll only one more dice:
roll it, add it to the rolls so far, pass that to the tabulator
otherwise:
roll a die, add it to the rolls so far and call ourselves, generating one less roll


Then you can tabulate all the number of different successes. So far, I have the results for pools of size 2-9 in and can edit the entry with the results.

• I wrote a program using C++ using basically this algorithm and managed to get my results. Thanks. Dec 12, 2014 at 9:30

This is actually pretty simple to calculate. First, there is a 1/3 chance of each dice being a 5 or 6. So you will get (dice pool size) / 3 successes from that to start.

After that, you need to calculate how many successes you get from adding other dice together. Since every result that isn't a 5 or 6 is going to be a 1, 2, 3, or 4, that means that your non-success rolls will average out to 2.5. This means that, on average, you will get one success for every two non-successful dice. Since 2/3 dice are not successful, this means that we get, on average, (dice pool size) / 3 successes from this as well. (2/3 divided by 2 is 1/3)

So, in the end, you will get an average of 2 successes for every 3 dice rolled.

• So, same as rolling a pool and counting dice showing 3+ as a success, but offering different dice-manipulation possibilities before counting successes. Interesting. Nov 28, 2014 at 19:38
• I suspect that the probability curve is also quite different, though I haven't done the math to find out. Nov 28, 2014 at 19:43
• In reality you get a little more thaan 50%. Just to show you, let's work with two failure dice and look at the probabilities: 1+1 1+2 2+1 1+3 3+1 2+2 are the no results. 3+2 2+3 3+3 4+1 1+4 4+4 4+3 3+4 2+4 4+2 are the ok results. It's 5/8 and I guess it grows when you have more failure dice to combine togheter since you can choose the best combinations, plus you can also sum 3 or 4 low dice into a success. Nov 28, 2014 at 19:53
• Yeah, the idea I had for the system would be that you could add together something like (1,1,1,2) to make a success just as much as you could (2,3) or (4,1). Nov 28, 2014 at 21:04
• I think this will over-estimate the successes. Consider when you have 1 die left over (i.e. a die which is not 5 or 6), it doesn't contribute 1/3 of a success - it contributes 0. When you have 2 dice left over, by your approach 1/3 of 2 is 2/3 of a success, but when we enumerate the 16 outcomes, the actual proportion that reach 5 or more is 10/16 (a bit less). With three dice left over, you can never get more than 1 sum of 5, but you can get 0, so again it's less than 1/3 of 3. And so on - looks like there's always some 'wastage'. So you'll average a bit fewer than 2 successes per three dice. Nov 29, 2014 at 2:37

While @AgentPaper has provided a very nice formula, reality is slightly different.

I used a small python script to calculate the average number of results over 100000 tries.

import random, math

rep = 100000
data =[]
for n in range(1,11):
result = []
for _ in range(rep):
R = sorted([random.randint(1,6) for __ in range(n)])
S = R.count(6)+R.count(5)
R = R[:-S]
while len(R)>1:
# Take highest number in R
x = R.pop(-1)
try:
# Try to find lowest complement to 5.
R.pop(next(R.index(i) for i in R if x+i>=5))
S+=1
except StopIteration:
# No complement found? Put (highest+lowest) back into list.
R.append(x+R.pop(0))
result.append(S)

avg = sum(result)/float(rep)
dev = math.sqrt(sum([(result[i]-avg)**2 for i in range(rep)])/(rep-1))
print('{}: {:.2f}+-{:.2f}'.format(n,avg,dev))


The result is the green line, complete with standard deviation (of the single result, not the mean) the red line shows 2/3 #dice for comparison.

While this seems odd, as AgentPaper is not incorrect in his calculations, I believe the deviation is caused by left-over dice that can't be added up to 5.

As pointed out by Chris, instead of randomly rolling 100000 times, you can iterate over every single possible result. The number of such results is 6^n, which means this method takes quite some time for high n. To do so, you change the above code to use the following:

import random, math
from itertools import product

data =[]
for n in range(1,11):
rep = 6**n
result = []
for r in product([1,2,3,4,5,6],repeat=n):
R = sorted(list(r))
S = R.count(6)+R.count(5)
[...]

• FWIW if you are going to use brute force on something like this I'd have thought it was better to just brute force all the possible dice rolls rather than use a statistical approach to this. Especially true for the smaller number of dice. For less than 8 dice you have less than 1,000,000 possibilities so less than the number you worked out randomly (if I read what you did correctly). Dec 1, 2014 at 23:27