Take and Roll II
Problem
You are given a fair -sided die and actions in a game. The die starts with upface . The two options you can perform are to roll and to take. Performing a roll re-rolls the current upface of the die. Performing a take allows you to cash out the current upface of the die. Note that the game does not end when you perform a take. However, you must roll the die again before doing another take. Your strategy is to accept any number that is at least some threshold . This must be decided in advance and is fixed for the entire game. Assuming rational play in selecting , find your expected payout.
Original Problem Link: https://www.quantguide.io/questions/take-and-roll-ii
Solution
Tracking every possible sequence of rolls across actions is hopeless: for each threshold , the number of possible games explodes. So we don't track individual outcomes at all. We play entirely in the world of expectations.
The plan has two parts:
- For a fixed threshold , find the expected total payout as a function of .
- Maximize that expression over .
Step 1: The shape of one "cycle"
With a fixed threshold , the game repeats the same pattern over and over:
- keep rolling until the upface is at least ,
- then take it.
(The die starting at fits right in: we must roll before our first useful take anyway.)
Suppose we knew
which we'd expect to be a function of itself. That would be enough, because then one cycle costs, on average, rolls followed by take, i.e. actions. Both rolling and taking use up actions, so out of our actions we get
Step 2: The payout of one take
What do we pocket on each take? It could be anything from to . But conditioned on landing on something , each of the values is equally likely (the die is fair, and we only ever stop on the first acceptable value). So the expected payout per take is just their average:
Step 3: The total, in terms of and
Multiplying the expected number of takes by the expected payout of each,
Everything now hinges on finding .
Step 4: Finding with a Markov chain
Think of the game as a tiny Markov chain with two states: "currently below " and "reached something " (absorbing, since that's where we stop and take). Let be the expected number of fresh rolls needed to hit a value .
The trick, as with Markov chains in general, is to condition on what happens on the very next roll and notice that the process then restarts:
- With probability (the values out of ), the roll is acceptable. That took exactly roll, and we're done.
- With probability (the values ), the roll fails. We've spent roll, and since the die has no memory we are right back where we started, needing more rolls on average.
By conditional expectation,
where the accounts for the failed roll itself plus the fresh start after it. Expanding,
(This is just the mean of a geometric distribution with success probability , which is a nice cross-check.)
Sanity checks.
- As grows, fewer values are acceptable, so we should need more rolls on average, and indeed increases with .
- At every value is acceptable, so exactly one roll always does it: . ✓
- At only a works, a chance per roll, so we expect rolls. ✓
So .
Step 5: Plug back in
so the expected total payout becomes
The trade-off is visible right in the formula. Raising increases the payout per take, , but shrinks the number of takes, .
Step 6: Maximize over
Plotting on Desmos, the curve peaks just past . We can also pin that down exactly. Writing and setting the derivative's numerator to zero,
But has to be an integer, so we check the neighbors:
- :
- :
- :
So the best threshold is : accept anything or above, reroll through .
A caveat on exactness. " takes" treats the game as a long-run rate, as if cycles always fit neatly into the actions and fractional takes were allowed. But a take only pays when a cycle actually completes, and the last cycle can get cut off mid-reroll. The natural fix is to count only whole cycles, with a floor:
and plot that directly on Desmos as
y = floor(100(21-x)/(41-x)) * (20+x)/2. The curve turns into a staircase, and the jumps matter: at the expected cycles round down to (payout ), while at the cycles only lose a sliver, rounding to (payout ). So the floored version actually prefers .Even the floor is still an approximation, though, because the number of completed cycles is itself random, and the average of a floor is not the floor of an average. Solving the -action game exactly (a dynamic program over every state) gives , and for . So the true optimum is with an expected payout of about , a little under . The expected-cycle model lands on the right threshold, and is the intended answer under that model.