There is a game on which I am working now and I need to balance it.
There are N=10 dices and K=3 attempts for throw them simultaneously. If a 6 comes up on any die, then this die is transferred to the winning dice pool, and the number of attempts becomes 3 again. The game continues either until the dice run out or until the attempts run out.
For example:
- N=10, K=3, the player rolled 0 dices with the number 6. Next turn.
- N=10, K=2, the player rolled 6 dices with the number 6. Next turn.
- N=4, K=3, the player rolled 0 dices with the number 6. Next turn.
- N=4, K=2, the player rolled 0 dices with the number 6. Next turn.
- N=4, K=1, the player rolled 0 dices with the number 6. Game is over, there are 6 dices in the winning pool.
Questions:
- What is the average number of dice in the winning pool? What will be the standard deviation?
- What is the probability that there are exactly n dice in the winning pool, where n is in [0..N]?
- How to generalize the solution for an arbitrary number of dice (N), an arbitrary number of attempts (K), and an arbitrary probability (p) of rolling 6 (not necessarily 1/6)?
Thank you in advance for your helping!
The game ends at a particular value of $N$ only if $KN$ rolls fail; the probability for that is $(1-p)^{KN}$. Otherwise, you end up at a lower value of $N$ with the number of attempts reset to $K$. The probabilities for reaching the possible lower values $n$ of $N$ are proportional to the binomial probabilities $\binom Nn(1-p)^np^{N-n}$, but we have to rescale those to add up to $1-(1-p)^{KN}$ instead of $1-(1-p)^N$, since the value $(1-p)^N$ for $n=N$ has been replaced by $(1-p)^{KN}$. Thus the transition probabilities from state $N$ to state $n$ are
$$ P(N\to n)=\begin{cases}(1-p)^{KN}&n=N\;,\\\frac{1-(1-p)^{KN}}{1-(1-p)^N}\binom Nn(1-p)^np^{N-n}&n\lt N\;.\end{cases} $$
Since the number of dice in the winning pool is just the difference between the initial and final values of $N$, you can calculate the expectation and variance of the final value $M$ of $N$ instead, which yields slightly nicer expressions. Let $E_{iN}$ be the expected value of $M^i$ (where $i$ will be $1$ or $2$) starting with $N$ dice. Then with the above transition probabilities we have the recurrence
$$ E_{iN}=(1-p)^{KN}N^i+\frac{1-(1-p)^{KN}}{1-(1-p)^N}\sum_{n=0}^{N-1}\binom Nn(1-p)^np^{N-n}E_{in}\;. $$
The initial values are $E_{i0}=0$. I doubt that this can be solved in closed form. The first few values for your example with $K=3$, $p=\frac16$, and thus $1-p=\frac56$, are
$$ E_{11}=E_{21}=\left(\frac56\right)^3\;, $$
\begin{eqnarray} E_{12} &=& \left(\frac56\right)^6\cdot2+\frac{1-\left(\frac56\right)^6}{1-\left(\frac56\right)^2}\cdot2\cdot\frac56\cdot\frac16\cdot\left(\frac56\right)^3 \\ &=& \frac{5138125}{5038848} \\ &\approx& 1.02 \end{eqnarray}
and
\begin{eqnarray} E_{22} &=& \left(\frac56\right)^6\cdot2^2+\frac{1-\left(\frac56\right)^6}{1-\left(\frac56\right)^2}\cdot2\cdot\frac56\cdot\frac16\cdot\left(\frac56\right)^3 \\ &=& \frac{8513125}{5038848} \\ &\approx& 1.69\;. \end{eqnarray}
Thus, if we start with $N=2$ dice, we have
$$ E[M]=E_{12}\approx1.02 $$
and
\begin{eqnarray} \operatorname{Var}[M] &=& E_{22}-E_{12}^2 \\ &=& \frac{8513125}{5038848}-\left(\frac{5138125}{5038848}\right)^2 \\ &=& \frac{16496014364375}{25389989167104} \\ &\approx& 0.65 \;. \end{eqnarray}