2
\$\begingroup\$

I am not much of a programmer. While I have figured out how to do basic things with anydice, I am having trouble figuring out the least probability of successes needed for a difficulty number from 2-10 for 1 to 15 dice using D10s.

The system basics are:

  • It uses a D10 dice pool system
  • Your success check is based on your attribute score
  • Your skill determines the number of dice you get to roll
  • If a 10 is rolled it counts as 2 successes.

I need a code that determines the least number of successes needed at any difficulty of 2-10 using between 1d10 to 15d10 dice. (Any time a 10 is rolled it would count as 2 successes).

I saw the code below for World of Darkness. It almost works for what I want, but instead of exploding dice on a D10 score of 10, I need the 10 to count as 2 successes. If anyone can help me modify the code to achieve that output it would be great.

function: nwod R:n again N:n {
  if N >= R { result: 1 + [nwod R again d10] }
  result: N >= 8
}

NWOD: [nwod 10 again d10]

loop N over {1..10} {
  output [lowest of 10 and NdNWOD] named "[N]d"
}
\$\endgroup\$
2
  • 2
    \$\begingroup\$ What probability do you need? A single success, or formula for n successes, or formula for at least n successes? \$\endgroup\$
    – kviiri
    Aug 24, 2016 at 7:57
  • \$\begingroup\$ Ya sorry I realized I did that late I am wanting a fomular or code that determines the least number of successes needed at any difficulty of 2-10 rolling between 1d10 to 10d10 dice. ' Any time a 10 is rolled it would count as 2 successes \$\endgroup\$ Aug 25, 2016 at 8:06

2 Answers 2

4
\$\begingroup\$

Following the example I made your Anydice for all possible skills, and a fixed attribute of 8. In case you want to change the attribute just change the 8 in the code for whatever value it should be.

function: successes in S:s {
result: (S >= 8) + (S = 10)
}

loop N over {1..10} {
output [successes in Nd10] named "[N]d"
}
\$\endgroup\$
1
  • \$\begingroup\$ yup that works thanks Albert I also updated what i was asking as it was late at night and not clear at all. Thanks for figuring it out for me \$\endgroup\$ Aug 25, 2016 at 8:09
2
\$\begingroup\$

The efficient way to handle such things in AnyDice is to define a custom die that directly gives the number of successes for each die rolled. For example, for a target difficulty number of 8 or above, you can use Nd{0,0,0,0,0,0,0,1,1,2} (or, more compactly, Nd{0:7, 1:2, 2}) to get the number of successes from rolling Nd10 vs 8.

The d{0,0,0,0,0,0,0,1,1,2} is simply a custom d10 with its sides relabeled, so that sides 1 to 7 will count as 0, sides 8 and 9 will count as 1, and side 10 will count as 2.

With a little bit of math, you can pretty easily define such custom dice for any difficulty target. Specifically, for a target value 1 ≤ T ≤ 10, there are T−1 ways to roll under T on a d10, 10−T ways to roll between T and 9 inclusive, and, of course, one way to roll a perfect 10. Thus, the custom die that gives the number of successes against the target T will be d{0:(T-1), 1:(10-T), 2}.

Here's an AnyDice program that plots the number of successes for any target number 1 ≤ T ≤ 10 and any dice pool size 1 ≤ N ≤ 15:

loop T over {1..10} {
  loop N over {1..15} {
    output Nd{0:(T-1), 1:(10-T), 2} named "[N]d10 vs. [T], double success on 10"
  }
}
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .