# In Anydice, how can I model nd10 where 8–10 counts as successes and 10s explode?

(Did some searching on SE and couldn’t find an answer…)

Trying to model nd10 where 8..10 count as successes and 10s explode.

output [count {8..10} in 3d10]


^ works with a 65.7% (= 44.1% + 18.9% + 2.7%) chance for at least one success.

However, when I try to add the ‘explode’ tag, the success rate drops…

output 3d[count {8..10} in [explode d10]]


^ success rate (1 or more) drops to 48.8%.

What am I doing wrong?

The trouble is that your exploded die counts as e.g. a single 18 rather than a 10 and an 8. You could instead label the die using successes (1) and non-successes (0)

output 3d[explode d10 >= 8]


but this would explode all successes, not just 10s. A trick you can do to distinguish exploding 10s is to subtract 1 from all non-exploding outcomes, which will be rolled exactly once per die, and add it back at the end:

output 3d([explode d{-1:7, 0:2, 1:1}] + 1)


As I understand your problem, a single die can explode and produce an additional success on a 8-10 but that if it’s a 10 then it explodes again and so on.

@HighDiceRoller has nailed the reason why your approach is not working in AnyDice but exploding dice, for sensible computational reasons, are limited in AnyDice anyway. While this limit has no material effect on the outcome (more than 2 explosions being a 1 in 1000 chance), we can do it analytically and get meaninglessly precise results.

First, let’s look at how many successes ($$\k\$$) we can get from a single die:

\begin{align} Pr(X=0) &= 0.7 &\text{(1-7)}\\ Pr(X=1) &= 0.2 + 0.1\times0.7 &\text{(8-9 + 10 & 1-7)}\\ Pr(X=2) &= 0.1\times0.2 + 0.1\times0.1\times0.7 &\text{(10 & 8-9 + 10 & 10 & 1-7)}\\ \end{align}

In general, for $$\k\ge 1\$$:

\begin{align} Pr(X=k)&= (0.2+0.1\times0.7) 0.1^{k-1}\\ &= (0.27) 0.1^{k-1}\\ &= {0.27\over0.9}(0.9)0.1^{k-1}\\ &= 0.3(0.9)(1-0.9)^{k-1} \end{align}

Now, apart from the $$\0.3\$$ constant, the right hand terms describe a geometric distribution (the first type) with $$\p=0.9\$$. We know an awful lot about geometric distributions.

For the chance of at least one success from 3 of these rolls … well, we actually didn’t need any of the above analysis. At least one success is the complementary event of no successes and its probability is $$\1-0.7^3=0.657\$$. But you knew that.

Anyway, if you have other questions - this might help.