2
\$\begingroup\$

For a dice pool of 6d6(4+), where any dice showing 4 or 5 or 6 is a success, what is the anydice formula to have the probability of at least a double among the 4+ dice?

The goal is to know the chance for successfull rolls to show doubles and beyond only among the success faces.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

It's 66.49%. Here's the formula I used:

function: any doubles of N:n or above in ROLL:s {
  loop X over ROLL {
    if X >= N & (ROLL = X) > 1 {
      result: 1
    }
  }
  result: 0
}

D: d{0,0,0,4,5,6}

output [any doubles of 4 or above in 6dD]

The function is quite straightforward: we loop over every number X in the roll, and check whether:

  1. X is at least 4, and
  2. X occurs more than once in the roll.

If both conditions are true for any X, we return the number 1; if they hold for no value of X, we return 0 at the end of the loop.

The most important part of this code is the :s after the parameter name ROLL in the function declaration, which tells AnyDice that we want this parameter value to be a sequence of numbers. When we instead pass in a dice pool, AnyDice automatically calls the function with every possible result of rolling the dice and collects the results returned by the function into a new custom die weighted by their probabilities.


Ps. The custom die D is not strictly necessary: you'll get exactly the same results if you replace 6dD with 6d6 in the code above. But relabeling all the sides below 4 with the same number makes the code run slightly faster, since AnyDice doesn't have to loop over as many distinct but equivalent possible rolls.

\$\endgroup\$

You must log in to answer this question.

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