Quant Memo
Foundational

The Dice Game Pig and Optimal Stopping

Working out the optimal 'hold at 20' rule for the dice game Pig from first principles, and why it's the cleanest introduction to optimal-stopping thinking you'll meet in an interview.

Prerequisites: Craps: Working Out the House Edge

The game. On your turn in Pig, you repeatedly roll a single die. Each roll adds its value to your turn total — unless you roll a 1, in which case you lose everything accumulated this turn and your turn ends immediately. At any point before rolling a 1, you can choose to "hold," banking your turn total permanently. The question: what's the optimal stopping rule, and roughly why does it land where it does?

This is a genuinely rich optimal-stopping problem hiding behind a simple game, and it's a favorite interview vehicle because a clean, intuitive rule ("hold at 20") turns out to be a very good approximation to the mathematically optimal (and much more complicated, state-dependent) policy.

Setting up the one-roll decision

At any point in your turn with current turn total tt, rolling once more has two outcomes: with probability 5/65/6 you get a uniform value from {2,3,4,5,6}\{2,3,4,5,6\} added (average 44 conditional on not rolling a 1), and with probability 1/61/6 you lose the entire turn total tt. The expected change in your turn total from one more roll is

E[Δ]=56(4)16(t)=20t6.E[\Delta] = \frac{5}{6}(4) - \frac{1}{6}(t) = \frac{20 - t}{6} .

In plain English: rolling again is worth it, in expectation, exactly when the expected gain from a good roll (56×43.33\frac{5}{6}\times 4 \approx 3.33) outweighs the expected loss from busting (16×t\frac{1}{6} \times t) — and those two forces balance exactly when t=20t = 20.

Worked example: why the crossover is at 20

Set E[Δ]=0E[\Delta] = 0: 20t6=0t=20\frac{20-t}{6} = 0 \Rightarrow t = 20. Below t=20t=20, E[Δ]>0E[\Delta] > 0 — rolling again has positive expected value, so you should keep rolling. Above t=20t=20, E[Δ]<0E[\Delta] < 0 — you have more to lose (a large banked total from this turn) than to gain from one more average roll, so you should hold. Check t=15t=15: E[Δ]=(2015)/6=0.83E[\Delta] = (20-15)/6 = 0.83, positive, keep rolling. Check t=25t=25: E[Δ]=(2025)/6=0.83E[\Delta] = (20-25)/6 = -0.83, negative, hold. This gives the well-known "hold at 20" heuristic: as soon as your turn total reaches 20, bank it.

turn total t E[Δ] t = 20 (hold here) keep rolling hold
Expected change per roll falls as turn total rises, crossing zero exactly at turn total 20 — below that, one more roll is worth it in expectation; above it, it isn't.

Why the true optimum is more subtle (but close)

The one-roll analysis above only checks "is one more roll worth it," treating everything after as fixed. The actual optimal policy accounts for your opponent's current score too — if you're far behind, it's worth pushing your luck higher than 20 because a modest expected gain isn't enough if you need a big turn to catch up; if you're far ahead, holding earlier can lock in a win faster. Computed via dynamic programming (backward induction over game states), the fully optimal policy varies the hold threshold between roughly 20 and 27 depending on both players' scores — but "hold at 20," derived from the simple one-roll expected-value argument above, gets remarkably close to optimal play throughout the game.

The core move in Pig is a one-step expected-value comparison: compare the expected gain from one more roll (56×4\frac{5}{6}\times 4) against the expected loss if you bust (16×t\frac{1}{6} \times t), and solve for the turn total tt where they balance — t=20t=20. This "myopic" one-step analysis is a standard first move on any optimal-stopping problem, even when the fully optimal answer requires looking further ahead.

The general pattern — compute the expected value of "one more step" as a function of your current state, find where it crosses zero — is the same technique behind stopping rules in the secretary problem and in real trading decisions like "when to take profit on a position with a known edge but rising downside risk."

Don't mistake the myopic "hold at 20" rule for provably optimal play. It's a very good approximation derived from a one-roll lookahead, but the true optimal policy is state-dependent (it varies with both players' current scores) and can only be pinned down exactly via full backward induction over the game tree — a distinction worth naming explicitly if an interviewer pushes on "is that actually optimal?"

Related concepts

Practice in interviews

Further reading

  • Neller & Presser, Optimal Play of the Dice Game Pig (2004)
ShareTwitterLinkedIn