# How can I get AnyDice to determine these odds?

After looking at AnyDice's Documentation and Function Library, I remain baffled. I know that AnyDice can do this, but I don't know how to tell it to. Scott Gray's Dice Pool Generator is easier to use but doesn't return the results I need, or, at least, I lack arithmetic sufficient to force it to.

The mechanic uses a 6-die pool with a target number of 4. I need to know the percentage chances of rolling a 4 or higher on 1 or more, 2 or more, 3 or more, 4 or more, 5 or more, and all 6 dice in the pool using the following pools of dice:

• 6d4
• 5d4 and 1d6
• 4d4 and 2d6
• 3d4 and 3d6
• 2d4 and 4d6
• 1d4 and 5d6
• 6d6
• 5d6 and 1d8
• 4d6 and 2d8

... and so on until 6d12 becomes 5d12 and 1d20. I can do 6d4 and 6d6 myself, but I wanted the progression to be clear. (I'm skipping d14s and d16, by the way, because I couldn't find d18s, and most folks don't own d14s and d16s anyway.)

Can this be done?

By the way, the results needn't be from AnyDice--that's just frequently mentioned as a good odds generator. Results are the important part not the tool.

-

Here's the link to the program, and here it is in its entirety:

DICE:{4,6,8,10,12,20}
loop D over {1..(#DICE-1)}{
loop SECOND over {0..5}{
FIRST: 6-SECOND
FIRSTD: D@DICE
SECONDD: (D+1)@DICE
output [count {4..20} in FIRSTdFIRSTD] + [count {4..20} in SECONDdSECONDD] named "[FIRST]d[FIRSTD] and [SECOND]d[SECONDD]"
}
}

-
That's... beautiful. Thank you. I'm gonna let the question sit for a day to be polite, but this is exactly what I needed. – Hey I Can Chan May 7 '14 at 6:23
Is there a way to modify this program to include 14-, 16-, 24-, and 30-sided dice? – Hey I Can Chan May 17 '14 at 12:45
Theoretically, all it takes is modifying the DICE array to include those values, like so: "DICE:{4,6,8,10,12,14,16,20,24,30}"; then changing the two instances of {4..20} to {4..30} to expand the range of values being counted as successes. However, including d24 and d30 in this program seems to overflow something in Anydice. Once you start using d20s though, you're almost guaranteed to roll high enough. – Magician May 18 '14 at 13:25
@Macgian Adding d14s, d16s, and d24s works, but d30s leave the poor thing endlessly ...calculating... Weird. Thanks again. – Hey I Can Chan May 18 '14 at 14:05

GamesDice is a Ruby library that is aimed at slightly different use than AnyDice (mainly at Ruby developers who are looking for a library for manipulating and simulating dice systems).

Here is a Ruby script that uses GamesDice to calculate the odds. I won't post it here, if anyone has questions they can ask in comments on the gist, or on Stack Overflow.

Here is the output (now showing cumulative percentage of given number of successes or higher):

6d4, target 4+
1: 82.2%   2: 46.6%   3: 16.9%   4:  3.8%   5:  0.5%   6:  0.0%

5d4 + 1d6, target 4+
1: 88.1%   2: 56.5%   3: 23.5%   4:  6.0%   5:  0.8%   6:  0.0%

4d4 + 2d6, target 4+
1: 92.1%   2: 65.7%   3: 31.4%   4:  9.2%   5:  1.5%   6:  0.1%

3d4 + 3d6, target 4+
1: 94.7%   2: 73.6%   3: 40.2%   4: 13.7%   5:  2.5%   6:  0.2%

2d4 + 4d6, target 4+
1: 96.5%   2: 80.1%   3: 49.2%   4: 19.5%   5:  4.3%   6:  0.4%

1d4 + 5d6, target 4+
1: 97.7%   2: 85.2%   3: 57.8%   4: 26.6%   5:  7.0%   6:  0.8%

6d6, target 4+
1: 98.4%   2: 89.1%   3: 65.6%   4: 34.4%   5: 10.9%   6:  1.6%

5d6 + 1d8, target 4+
1: 98.8%   2: 91.0%   3: 69.5%   4: 38.3%   5: 12.9%   6:  2.0%

4d6 + 2d8, target 4+
1: 99.1%   2: 92.7%   3: 73.2%   4: 42.4%   5: 15.1%   6:  2.4%

3d6 + 3d8, target 4+
1: 99.3%   2: 94.1%   3: 76.7%   4: 46.6%   5: 17.7%   6:  3.1%

2d6 + 4d8, target 4+
1: 99.5%   2: 95.2%   3: 79.9%   4: 51.0%   5: 20.6%   6:  3.8%

1d6 + 5d8, target 4+
1: 99.6%   2: 96.2%   3: 82.8%   4: 55.3%   5: 23.8%   6:  4.8%

6d8, target 4+
1: 99.7%   2: 96.9%   3: 85.4%   4: 59.6%   5: 27.4%   6:  6.0%

5d8 + 1d10, target 4+
1: 99.8%   2: 97.4%   3: 86.9%   4: 62.2%   5: 29.6%   6:  6.7%

4d8 + 2d10, target 4+
1: 99.8%   2: 97.8%   3: 88.3%   4: 64.7%   5: 31.8%   6:  7.5%

3d8 + 3d10, target 4+
1: 99.9%   2: 98.1%   3: 89.7%   4: 67.3%   5: 34.2%   6:  8.4%

2d8 + 4d10, target 4+
1: 99.9%   2: 98.4%   3: 90.9%   4: 69.7%   5: 36.7%   6:  9.4%

1d8 + 5d10, target 4+
1: 99.9%   2: 98.7%   3: 92.0%   4: 72.1%   5: 39.3%   6: 10.5%

6d10, target 4+
1: 99.9%   2: 98.9%   3: 93.0%   4: 74.4%   5: 42.0%   6: 11.8%

5d10 + 1d12, target 4+
1: 99.9%   2: 99.0%   3: 93.6%   4: 76.0%   5: 43.8%   6: 12.6%

4d10 + 2d12, target 4+
1: 99.9%   2: 99.2%   3: 94.2%   4: 77.5%   5: 45.7%   6: 13.5%

3d10 + 3d12, target 4+
1:100.0%   2: 99.3%   3: 94.8%   4: 78.9%   5: 47.5%   6: 14.5%

2d10 + 4d12, target 4+
1:100.0%   2: 99.4%   3: 95.3%   4: 80.4%   5: 49.5%   6: 15.5%

1d10 + 5d12, target 4+
1:100.0%   2: 99.5%   3: 95.8%   4: 81.7%   5: 51.4%   6: 16.6%

6d12, target 4+
1:100.0%   2: 99.5%   3: 96.2%   4: 83.1%   5: 53.4%   6: 17.8%

5d12 + 1d20, target 4+
1:100.0%   2: 99.7%   3: 97.1%   4: 85.7%   5: 57.3%   6: 20.2%

4d12 + 2d20, target 4+
1:100.0%   2: 99.8%   3: 97.8%   4: 88.1%   5: 61.4%   6: 22.9%

3d12 + 3d20, target 4+
1:100.0%   2: 99.9%   3: 98.4%   4: 90.3%   5: 65.5%   6: 25.9%

2d12 + 4d20, target 4+
1:100.0%   2: 99.9%   3: 98.8%   4: 92.2%   5: 69.7%   6: 29.4%

1d12 + 5d20, target 4+
1:100.0%   2: 99.9%   3: 99.2%   4: 93.9%   5: 73.7%   6: 33.3%

6d20, target 4+
1:100.0%   2:100.0%   3: 99.4%   4: 95.3%   5: 77.6%   6: 37.7%


I hope this is useful.

On a positive note, it looks like AnyDice and GamesDice agree on this distribution!

-

I usually use Troll for probability calculations like this. It also produces graphs. A few examples:

count 4<= 6d4
0     17.798     100.000
1     35.596      82.202
2     29.663      46.606
3     13.184      16.943
4      3.296       3.760
5      0.439       0.464
6      0.024       0.024

count 4<= (4d6 @ 2d8)
0      0.879     100.000
1      6.445      99.121
2     19.434      92.676
3     30.859      73.242
4     27.246      42.383
5     12.695      15.137
6      2.441       2.441


There's a downloadable script in addition to the web interface, and while I'm entirely sure it's possible to write a full script that will count down the one number while counting up the next, I'm not as proficient with it as I once was and don't have an example.

-