11
\$\begingroup\$

I've seen there are quite a lot of brilliant people on this board answering questions about Anydice. I am hoping somebody will be kind enough to answer this one too.

I want to use anydice to figure out the probability of success with opposing dice rolls. For example, 1d6+1d8 (test roll) vs 1d10+1d4 (challenge roll). The challenge roll determines the target number. If the test roll meets or exceeds the challenge roll, the attempt succeeds.

How do I set that up in Anydice?

\$\endgroup\$
  • 1
    \$\begingroup\$ Hi Nathal, welcome to rpg.se! Take the tour and visit the help center or ask here in the comment (use @ to ping someone) for more information. Good luck and happy gaming! \$\endgroup\$ – linksassin May 26 at 1:53
15
\$\begingroup\$

Anydice supports conditionals

Anydice can do this with the conditional operators (e.g. > < >= <= = !=). From the documentation page:

AnyDice allows you to compare two values, to check whether a certain condition is true. If so, the result will be a 1, otherwise a 0.

Therefore the simplest program you can make to do this is:

output (1d6+1d8) >= (1d10+1d4)

You can see this program here. Using brackets around the dice causes them to be treated a one distribution. >= is the symbol for 'greater than or equal to' which is the same as your 'meets or exceeds' condition. If you wanted simply 'exceeds' use > for 'greater than' instead.

You could easily make this into a function like this but it provides little benefit over the base program.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you for what you've explained, it is a great help, and almost embarrassingly easy now that I see it written. But I do have another question. I see in the documentation the author shows conditions for greater or "at least." I am guessing "at least" would be my "meets or exceeds" criteria for beating the challenge roll. It looks to me as though the buttons allow the selection of those options in the Anydice menu for different table/graph output types. But I'm not sure if there's a way to ensure the probability shows meets or exceeds rather than just exceeds the opposing roll. \$\endgroup\$ – Nathal May 26 at 3:32
  • 3
    \$\begingroup\$ @Nathal How much to you know about conditional operators? > is 'greater than' and >= is 'greater than or equal to'. If you want meets or exceeds just change the > to >=. \$\endgroup\$ – linksassin May 26 at 3:36
  • \$\begingroup\$ @Nathal No problem. If you want to learn more about probably and such I would suggest doing some research on mathematics and statistics. \$\endgroup\$ – linksassin May 26 at 3:46
  • \$\begingroup\$ I noticed that all the symbols are in the documentation you mentioned as well, and I didn't recognize it for what it is. By the way, the "functions" in anydice...are they based on any particular programming language? I suspect that really shows my ignorance, but I ask anyway. lol \$\endgroup\$ – Nathal May 26 at 16:33
  • \$\begingroup\$ @Nathal: The syntax is a bit unusual, and I'm not sure if it's based on any other language, but under the hood they work very much like functions in any other programming language with dynamic variable scoping. (Don't worry if you don't know what that means. :) ) Well, except for the automatic iteration over dice rolls — that's a unique feature AFAIK. It's not too hard to emulate in other languages (see this answer for some examples in Python), but normally you need to do it explicitly. \$\endgroup\$ – Ilmari Karonen May 26 at 20:00

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.