← Pig against the computer

Pig Dice Game Strategy: Hold at 20, Hold at 25 and the Optimal Play

Pig is a finite game of chance, so every figure here is an exact probability, not a sample: we computed the optimal policy ourselves by value iteration over all 505,000 states and evaluated each strategy against each level of this page, taken verbatim from its code. Simulated games with the page's own code — 200,000 per figure — agree with every number.
The short answer

In Pig, “hold at 20” maximises the points you bank per turn, but “hold at 25” wins more games: 47.9% against the optimal level here versus 46.0%, because four turns of 25 reach 100 and four turns of 20 do not. Add one clause — once the opponent has 71 or more, keep rolling until you reach 100 — and simple rules climb to 48.6–49.5% against perfect play, whose own ceiling is 50%. The player who starts wins 53.1% of games between two optimal players; on this page a die toss decides who starts, exactly 50/50.

The rules on this page, exactly

Pig has many house variants — two dice, different targets, a lost bank on double ones. The figures on this page are for its exact rules, read from the code:

  • One die. A roll of 2–6 adds to your turn points; a 1 wipes them and passes the die.
  • Hold moves the turn points into your bank and passes the die. You cannot hold before your first roll of the turn.
  • The target is 100. The moment your bank plus your turn points reaches 100, you have won — you do not need to press Hold.
  • Who starts is decided by a toss: each side rolls a die, equal dice are rolled again, the higher die starts. That is exactly 50/50.

Starting matters. Between two optimal players the first player wins 53.06% of games — the same figure Neller and Presser published in 2004. Between two players who both hold at 20 it is 53.47%. So whatever your strategy, expect to win about six games in a hundred more when the toss goes your way than when it does not.

Why 20, and why 25 wins more games

The case for 20 is simple arithmetic. With k points on the turn, one more roll gains 4 points on average when it is not a 1 (5 times in 6) and loses k when it is (once in 6). The roll pays while 20/6 is more than k/6, that is, while k is under 20. So holding at 20 maximises the points banked per turn: 8.14 on average.

Hold atTurns that reach the targetPoints banked per turn, on average
1547.0%7.85
2037.6%8.14
2530.0%8.00
3023.9%7.58

But Pig is won by reaching 100 first, not by banking the most per turn, and the difference shows. A banked turn under “hold at 20” is worth 20–25 points, so it usually takes five of them; under “hold at 25” four are enough. Here is what a fixed threshold scores, as exact winning chances against each level of this page:

You hold atvs holds at 20vs keeps pacevs optimal play
1544.3%40.1%41.2%
1847.2%43.5%44.1%
2050.0%44.8%46.0%
2248.3%44.8%44.6%
2450.8%47.5%47.8%
2551.2%47.1%47.9%
3046.1%41.6%42.6%
3347.3%47.0%45.4%

The curve is not smooth: 22 is worse than both 20 and 25, and 33 is better than 30. Each bump is a threshold that changes how many banked turns you need. Of all fixed thresholds from 12 to 40, 25 is the best against the “holds at 20” and optimal levels, and 24 against “keeps pace”.

Against the “holds at 20” level, holding at 20 yourself is a mirror match and scores exactly 50%. Holding at 25 beats it 51.2% of the time.

The optimal policy, computed

Todd Neller and Clifton Presser solved this game in 2004 (“Optimal Play of the Dice Game Pig”). We repeated the computation independently: value iteration over every state — your bank, the opponent's bank, the turn points — to a precision of 10−14. The table below is the result: the turn total at which the optimal player stops rolling and holds.

Your bank ↓ / theirs →02040608090
02123263249to 100
201921243039to 100
4018192124to 100to 100
6016181618to 100to 100
70121111to 100to 100to 100
80to 100to 100to 100to 100to 100to 100

Three patterns can be read from it and remembered:

  • Even scores early: hold at about 20. At 0–0 the optimal player rolls on 20 and holds on 21; the difference between the two choices is 0.06 percentage points of winning chance.
  • Behind: roll longer. Ahead: stop sooner. Down 0 to 60 it holds only at 32; up 60 to 0 it holds at 16.
  • When the opponent is close, it stops holding altogether and rolls until it reaches 100. With your bank at 0 that starts when the opponent has 84, at 40 when they have 78, at 60 when they have 64. With 80 or more of your own, it never holds short of 100.

The surface is lumpy, as the game's own article says: with 20 in your bank the optimal player holds at 30 against an opponent on 60, but at 25 against one on 70. No formula reproduces it exactly, which is why the rules in the next section are approximations.

The table this page builds for its top level agrees with ours to within 0.000002 in every state, and makes the same decision in 494,999 of the 495,000 states where there is a choice. The one exception, 41 against 0 with 17 on the turn, is a near-tie: the two options differ by 0.00002 percentage points.

Rules you can actually use

The single most valuable addition to any fixed threshold is a racing clause: once the opponent has 71 or more, stop holding and roll until you reach 100. A safe hold there rarely gets the die back in time. Neller and Presser's own heuristic, “keep pace and end race”, adds a second idea: move the threshold by one point for every eight points of score difference.

Your rulevs holds at 20vs keeps pacevs optimal play
Hold at 2050.0%44.8%46.0%
Hold at 2551.2%47.1%47.9%
Hold at 20; roll to 100 once the opponent has 71+54.5%50.5%48.6%
Hold at 25; roll to 100 once the opponent has 71+53.5%49.9%48.7%
Keep pace and end race: if either bank has 71+, roll to 100; otherwise hold at 21 + (their bank − yours) / 8, rounded54.6%51.1%49.5%
Optimal play54.0%51.4%50.0%
The best possible strategy against that level55.5%52.9%50.0%

Two things in this table are worth noticing. First, “keep pace and end race” costs only half a point against perfect play: 49.5% against 50.0%. Second, the optimal policy is not the best way to beat a weak opponent. It is optimal against an optimal opponent; against “holds at 20” it wins 54.0%, while the strategy computed specifically against that level wins 55.5%, and even the simple “keep pace” rule beats the optimal one there.

“Rounded” means to the nearest whole number. Example: you have 30, they have 54. They lead by 24, and 24 / 8 = 3, so you hold at 21 + 3 = 24. With 54 against their 30, you hold at 21 − 3 = 18.

What each level does

All three levels play from the same rules as you and see the same die; none of them cheats.

  • Holds at 20. Rolls while its turn is worth less than 20, whatever the score. It never races: with you on 95 it still banks at 20.
  • Keeps pace. Holds at 21 + (your bank − its bank) / 8, rounded down, so even a one-point lead lowers the target to 20; never below 15. When your bank reaches 71 it rolls until it reaches 100.
  • Optimal play. The full Neller–Presser table, computed in your browser when the page loads (78 milliseconds of computation in our test). It picks whichever of roll and hold has the higher chance of winning.
Computer's bankYour bank“Keeps pace” holds at
0021
04026
40016
07029
071rolls to 100
803015

The last row is a quirk worth knowing. The game's article says this level races “the moment either bank gets close”, but in the code only your bank triggers the race; Neller and Presser's rule races on either. When the computer is at 80 and you are far behind, it banks small turns at 15 instead of finishing. That leak gives you almost a full point: optimal play wins 51.4% against this level, and would win 50.5% against the textbook rule.

How much is luck

A lot. Even the worst sensible rule in the tables above wins more than four games in ten against perfect play, and the difference between a good rule and a plain one is a few percentage points. Over a short match that disappears in the noise. Here is the chance of winning more than half of a match against the optimal level:

Games in the matchHold at 20 (46.0% a game)Optimal play (50.0% a game)
1028%38%
5024%44%
10018%46%
5003%48%

Draws within a match (exactly half) count as not winning, which is why even the 50% column stays under one half. Over fifty games the four-point edge of good play over “hold at 20” is still smaller than the luck: one standard deviation of your score over fifty games is seven points. It takes several hundred games for the difference to become clear.

The exact chances against each level depend a little on who starts: holding at 20 against the optimal level, you win 49.2% of the games you start and 42.9% of the games it starts.

Questions and answers

What is the best strategy in the Pig dice game?

The exact optimum depends on both scores and has been computed (Neller and Presser, 2004), but a short rule gets within half a percentage point of it: if either player has 71 or more, keep rolling until you reach 100; otherwise hold at 21 plus the opponent's lead divided by 8. Against perfect play that rule wins 49.5% of games; perfect play itself wins 50%.

Should you hold at 20 in Pig?

Holding at 20 maximises the average points banked per turn, 8.14, but it does not maximise wins. Against perfect play it wins 46.0% of games, holding at 25 wins 47.9%, because four turns of 25 reach 100 while 20s usually need five. The bigger gain is to stop holding once the opponent has 71 or more.

Is there a first-player advantage in Pig?

Yes. With 100 as the target, the first player wins 53.06% of games between two optimal players and 53.47% between two players who hold at 20. On this page a die toss decides who starts, so each side gets the advantage exactly half the time.

When should you stop rolling in Pig?

Early in the game, with even scores, at about 20 to 25 points on the turn. Stop later when you are behind and sooner when you are ahead — at 0 against 60 the optimal player holds only at 32. Once the opponent reaches the high 70s or the 80s (earlier the further along you are yourself), or you need 20 or fewer, do not hold at all: roll until you win.

Is Pig a solved game?

Yes. Todd Neller and Clifton Presser computed the optimal policy for two-player Pig to 100 in 2004 by value iteration over about half a million states. The first player wins 53.06% under optimal play. Solved does not mean decided: the optimal player still loses nearly half its games against good opposition.

Can you beat the computer at Pig?

Often. Against the optimal level the best you can do is 50% over many games, and a decent rule gets 48–49.5%. Against “holds at 20” you can win up to 55.5% and against “keeps pace” up to 52.9%, for example by holding around 20–25 and racing once the computer passes 71.

Play Pig against the computer →
Where to go from here
To cite this page: “Pig Dice Game Strategy: Hold at 20, Hold at 25 and the Optimal Play”, You vs Computer, https://youvscomputer.com/games/pig-strategy.html