0
$\begingroup$

I'm wondering if someone can give the analytical solution to this problem:

  1. You start with a single die.
  2. You roll the die, if the result is <5 then you lost the die while if the result is >= 5 you gain an extra die such that you now have 2 dice.
  3. You continue rolling all your dice one by one until you have no die left.

For clarity: Say you have 2 dice now, you roll one of them and get 4. Since 4<5 you lost that die and are left with a single die. If you were to get a 6, you will get an extra die such that you now have 3 dice. The game ends when you are left with no die.

All the dice have uniform probabilities of getting 1-6. Let $X$ be the random variable representing how many rolls you did. What is $E[X]$ and $Var[X]$?

Two possible sequence of the number of dice that you have is: 1 2 1 0 (you rolled 3 times) and 1 2 3 2 1 0 (you rolled 5 times).

I've done simulation in R which suggests that $E[X]=3$ and $Var[X]=24$, but I can't seem to prove this analytically. My simulation code is as follows:

library(purrr)

set.seed(102)

number_of_simulation <- 10^6
roll <- 0
number_of_dice <- 1
simulation_number <- 1
simulation_result <- c()

for(simulation_number in 1:number_of_simulation){
  while (number_of_dice>0){
    roll <- roll + number_of_dice
    roll_result <- rdunif(number_of_dice,1,6)
    number_of_dice <- 2*sum(roll_result>4)
  }
  simulation_result[simulation_number] <- roll
  simulation_number <- simulation_number + 1
  roll <- 0
  number_of_dice <- 1
}

mean(simulation_result)
var(simulation_result)

Note

This problem arises from "Dice & Fold", a game released in 2Q24 on Steam. The starting character is called Jack. His skill is to roll 2 dice given that you can provide him with a die greater than 4. There exists a trinket in the game that gives you +2 heal whenever you use a skill. The expected value of the heal amount we get if we use all our dice for this skill is $2E[X]$ times the number of dice that we have at the beginning of the round. Thus, this problem.

$\endgroup$
4
  • $\begingroup$ I miss the information what exactly happens after step 3. More precisely, if you have more than one die, what exactly are the conditions to lose or win dice? $\endgroup$ Commented Sep 5 at 9:02
  • $\begingroup$ You roll all your dice one by one until you have none left. Say you have 2 dice now, you roll the first die and get a 4, since 4<5, you lost that die and are left with a single die. If you were to get a 6, you will get an extra die such that you have 3 dice now. $\endgroup$ Commented Sep 5 at 9:40
  • $\begingroup$ Please add essential information to the question rather than only mentioning it in comments. $\endgroup$ Commented Sep 5 at 9:53
  • $\begingroup$ @ChristianHennig done. Hope it helps. $\endgroup$ Commented Sep 5 at 10:00

1 Answer 1

3
$\begingroup$

This is a left-boundary biased random walk or a ruin game against an adversary with infinite resources. With each die roll, the number of dice increases by 1 with a probability $p=1/3$ and decreases by 1 with a probability $q=2/3$. The distribution of stoppings times is given by equation 4.14 on page 352 (page 370 of the pdf) of this book. The probability of stopping on roll $n$ from starting point $z$ is

$$u_{z,n}=\frac{z}{n}\binom{n}{(n+z)/2}p^{(n-z)/2}q^{(n+z)/2}$$

Note that $n$ and $z$ must have the same parity. The expected number of rolls is $z/(q-p)=1/(2/3-1/3)=3$.

Plugging it into Mathematica further confirms your simulation results:

In[1]:= 
u = ProbabilityDistribution[(Binomial[k, (k + 1)/2] 2^((k + 1)/2))/(
   k 3^k), {k, 1, \[Infinity], 2}];
Mean[u]
Variance[u]

Out[2]= 3

Out[3]= 24
$\endgroup$
1
  • $\begingroup$ Thanks, this answers the question. Also, thanks fro the reference. $\endgroup$ Commented Sep 6 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.