# How can I calculate the probability of complete success with this mixed dice pool using AnyDice?

I've playing around with dice probabilities and have a spreadsheet that handles the calculation for basic probabilities rolling a set of dice and counting the number of successes. I am completely new to using any dice and have been reading the documentation and examples, but need help in figuring out to solve my problem. Any advice is much appreciated!

Here's what I'm trying to figure out: When rolling a pool of 4d6 a 5 or 6 is a success. Two of the dice need to be a five or a six to be a full success. The probability is roughly 41% of getting a full success. I figured that out with math.

Now to the more complicated scenario. Same rules as above except replace a d6 for a d8 and a result of 8 on that die counts as 2 successes a roll of 6 or 7 counts as one success. I am looking for the probability of complete success (two or more successes). So roll 3d6 and 1d8 looking for the probability of complete success.

Here are some examples:

• 3d6 and 1d8 -> 2,4,2 and 3 -> No successes
• 3d6 and 1d8 -> 3, 6, 5 and 4 -> Two successes condition met
• 3d6 and 1d8 -> 3, 4, 5 and 6 -> Two successes condition met
• 3d6 and 1d8 -> 1, 1, 3 and 8 -> 8 roll counts for two successes condition met
• 3d6 and 1d8 -> 4, 5, 2 and 5 -> One success condition not met (only 6 and 7 on the d8 count as success)
• 3d6 and 1d8 -> 5, 5, 2 and 8 -> Four successes condition met.
• 3d6 and 1d8 -> 4, 4, 2 and 7 -> One success condition not met.

Is this possible with AnyDice?

• If you have a potential solution then you should submit it as an answer, not as part of the question. Jul 6, 2019 at 23:55

In programming, there are often as many correct ways to solve a problem, as there are programmers. Sometimes even more. The best way to learn a tool is to read code, so here are three ways of solving your problem, showcasing the possibilities of anydice.

## Variant 1

When trying to inspect the all results of a die roll separately in anydice, it's often easiest to do so in a function which takes a number as a parameter, and pass it the die roll as an argument. So:

function: successes EIGHT:n { ... }

output [successes 1d8]


Next, it's only a matter of checking for favorable cases and keeping count:

SUCCESSES: 0
if EIGHT >= 6 { SUCCESSES: SUCCESSES + 1 }
if EIGHT >= 8 { SUCCESSES: SUCCESSES + 1 }


If we put it all together, it might look like this:

function: successes A:n B:n C:n EIGHT:n {
S: 0
if EIGHT >= 6 { S: S + 1 }
if EIGHT >= 8 { S: S + 1 }
if A >= 5 { S: S + 1 }
if B >= 5 { S: S + 1 }
if C >= 5 { S: S + 1 }
result: S
}

output [successes 1d6 1d6 1d6 1d8]


Now if we calculate the result and click "At Least", we can see that the probability of at least two successes is 46.3%.

## Variant 2

Another option is to simply construct a die that rolls the number of successes with their respective probabilities:

EIGHT: {}
loop N over {1d8} {
if N >= 8 { EIGHT: { EIGHT , 2 } }
else if N >= 6 { EIGHT: { EIGHT , 1 } }
else { EIGHT: { EIGHT , 0 } }
}

SIX: {}
loop N over {1d6} {
if N >= 5 { SIX: { SIX, 1 } }
else { SIX: { SIX, 0 } }
}

output 3dSIX + 1dEIGHT


We can then make us of the "At Least" visualization again to arrive at the same result.

## Variant 3

Inspired by Variant 2, given that the "successes" die is pretty easy to construct ourselves, we could also just write:

EIGHT: { 0, 0, 0, 0, 0, 1, 1, 2 }
SIX: { 0, 0, 0, 0, 1, 1 }

output 3dSIX + 1dEIGHT

• Thanks for the insight. These were very helpful. That's amazing you came up with three different answers. Jul 6, 2019 at 23:39
• I looked at the blades example in the documentation and this is what I came up with. I'm not sure exactly how anydice works but the 3d6 example came up with the same calculation. I'll post it as an answer to see if you think it works or now. Jul 6, 2019 at 23:48
• Your SIX die could also simply be defined as SIX: d6 > 4. Unfortunately, there's no similarly concise and convenient way to define the EIGHT die; it could be done by passing a d8 to a custom function that takes an :n parameter, but that would be more complex and verbose than your variant 3 and only slightly simpler than your variant 2. Jul 16, 2019 at 22:27