Let's say we roll a fair $d$-sided die, and if the die rolls $x$ or higher, we add 1 to the success count (let's define this as $h$) and roll again, but if we roll $y$ or lower, we subtract one from the success count and roll again, and if we roll between $x$ and $y$, we stop rolling.
So, we have three potential outcomes of any given roll:
- $P$, which has a probability of $\frac{d-x+1}{d}$, adds $1$ to $h$ and has us roll again.
- $N$, which has a probability of $\frac{y}{d}$ subtracts $1$ from $h$, and has us roll again
- $S$, which has a probability of $\frac{x-y-1}{d}$ and halts the game.
I have two questions I want help on: How can we calculate the probability of an arbitrary score in this game? And how do we generalise this to $m$ dice (where we start with $m$ dice, rerolling each die until that die hits the stop outcome, with $h$ being the accumulated score of all dice)?
I can build a probability generating function for this problem, and indeed it's not particular hard:
$$F(z)=\frac{x-y-1}{d}+\frac{(d-x+1)zF(z)}{d}+\frac{yz^{-1}F(z)}{d}$$
We can then unroll the recursion into:
$$F(z)=\frac{x-y-1}{d-(d-e+1)z-yz^{-1}}$$
The problem is converting this into a Mass Function. We seem to have a Geometric component to the distribution that has two potential outcomes, that even for a single die, there's an infinite number of potential outcomes that can result in any given $h$ - any roll that ends with $h$ more $P$ outcomes than $N$ outcomes needs to be counted, and I'm not clear on the best approach to doing this, let alone what the appropriate strategy would be for $n$ dice.
