5
\$\begingroup\$

I'm trying to use anydice to count the number of successes generated by rolling >= to a variable TN using a variable pool of d10s (with 0s counting as 0), that explode on 9s (by rerolling and adding to the 9).

TNs can be higher than 9. Pools can be 1 - 10, sometimes even higher.

I thought I was on the right track with something like:

output [count {13..30} in 5d[explode d{0..9}]]

... for a sample pool size of 5, with 13 as the sample TN. (30 was chosen arbitrarily because I don't know how to get anydice to just count >=13).

  1. 5d is as high as anydice will work for me. At a pool of 6d[explode d{0..9}] or higher, it stops working. Is there a different way to do this?

    1.2. I tried messing with function depth, but a) I'm not sure function depth is even used for what I think it is, b) I'm not sure I'm writing the function depth command correctly, and c) even if it's the right thing and I'm using it correctly, it's not having any effect on whether or not anydice can handle the calculation.

  2. When I am using the count X in Y function, is there any way to instead just count >= X? Some way to type:

    [count {>=13} in 7d[explode d{0..9}]]

    ... instead of:

    [count {13.."arbitrarily chosen high number"} in 7d[explode d{0..9}]]

    If that can be done, will it ease the calculation for anydice?

\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to the site! Take the tour. Although it's not necessary, it's sometimes useful to explain the purpose for a needed dice scheme. For example, variable TNs plus variable dice pools provide a huge variety of potential results and potentially allow the possibility of doing the the near-impossible, but the combo often leaves players not knowing how good their PCs are at something. (If the goalposts keep moving (TN), you don't know if you're a good kicker (dice pool)!) Just something to consider. No matter what, I hope someone can help! Thanks for participating and have fun! \$\endgroup\$ – Hey I Can Chan Jun 3 '18 at 18:39
  • \$\begingroup\$ @HeyICanChan Thank you. I hope so too. I've been googling and reading and rereading what I can find on the anydice language for a couple of days now, but I can't wrap my head around half of it. \$\endgroup\$ – Joel Jun 3 '18 at 18:57
5
\$\begingroup\$

The reason why your code is timing out is because AnyDice is calling the [count ... in ...]function with every possible result of rolling 5 of your dice. It's not smart enough to realize that, in this particular case, rolling e.g. (23, 8, 7, 3, 1) no different from rolling, say, (15, 12, 4, 0, 0). And with open-ended exploding dice, there are a lot of possible results to check.

Anyway, the solution to this problem is to move the 5d outside the [count ...]:

output 5d[count {13..30} in [explode d{0..9}]]

This works because counting successes is a linear operation; it doesn't matter whether you roll N dice at the same time and count how many of them succeed, or whether you roll one die, check whether it succeeds, and repeat that N times.

Once you do that, making the success range open-ended is even easier — with just one die rolled at a time, you can simply use the normal >= comparison operator to check for success:

output 5d([explode d{0..9}] >= 13)

Either way, as long as you do the success check one die at a time, it will run effectively instantaneously even for arbitrarily large pools.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.