Expansion to the General Case - Likelihood of Meeting a Threshold While Rolling Dice with Modifiers

35 Views Asked by At

(This post is inspired by the Soulbound TTRPG)

Say you're rolling 6-sided dice and each die that rolls at or above a certain threshold ($t$) is counted as a success. If you wanted to know the likelihood of getting exactly $x$ successes, we have a simple formulation:

$$\left(\begin{matrix} n \\ x \end{matrix}\right) ((6-(t-1))/6)^{x} ((t-1)/6)^{n-x}$$

But now say we have a pool of +1 modifiers that we can use to modify the results of the dice. For example, if our success threshold is 4, we have one +1 modifier, and we roll a 3, we could then use our +1 modifier to upgrade that 3 to a 4 making it a success. This makes the math a bit more complicated, but not unmanageable.

We can find the likelihood of $x$ successes as the likelihood of rolling exactly $x$ successes, and removing all cases where upgrading a die or dice would give us more than $x$ successes. We then add the cases where fewer than $x$ successes were rolled initially, but modifiers were used to get up to $x$ successes.

The cases where modifiers can be used seem to grow like $\sum_{i=1}^{m}i$ for a pool of $m$ modifiers. For example, a pool of 1 +1 modifier has only one case where the modifier can be used, which would be if there is at least 1 die with value $t-1$. A pool of 2 +1 modifiers has three cases where dice can be upgraded:

  • Exactly 1 die at $t-1$ (+1 success)
  • Exactly 0 dice at $t-1$ and at least one die at $t-2$ (+1 success)
  • At least 2 dice at $t-1$ (+2 successes)

For 3 +1 modifiers we have six cases:

  • Exactly 1 die at $t-1$ and 0 dice at $t-2$ (+1 success)
  • Exactly 0 dice at $t-1$ and at least 1 die at $t-2$ (+1 success)
  • Exactly 0 dice at $t-1$ & $t-2$ and at least 1 die at $t-3$ (+1 success)
  • Exactly 1 die at $t-1$ and at least 1 die at $t-2$ (+2 successes)
  • Exactly 2 dice at $t-1$ (+2 successes)
  • At least 3 dice at $t-1$ (+3 successes)

These are the only cases I had to account for, but I'm curious if these cases continue to grow in this pattern and whether or not there is a programmatic way of generating all cases for any given modifier pool size?