You 0
turn points 0
Computer 0
Who starts? Press Roll
No finished games in this game yet
← All games

Pig against the computer

The Pig dice game against the computer: roll on or bank your points. The machine knows the exact odds of every state. Free, no sign-up, in the browser.

What this game is

Pig is a dice game with one decision, repeated: roll again, or stop while you are ahead.

On your turn you roll one die as many times as you like. Every roll adds its value to your turn points — except a 1, which destroys them and passes the die. Pressing Hold moves the turn points into your bank and passes the die anyway. First bank to reach 100 wins; there are no draws. The rules fit in three sentences, and yet the right answer to “one more roll?” depends on three numbers at once: your bank, the opponent's bank and what is riding on the current turn.

What “solved” means here

In 2004 Todd Neller and Clifton Presser published “Optimal play of the dice game Pig”: for every one of roughly half a million states they computed, by value iteration, the exact probability of winning after rolling and after holding. Playing optimally just means picking the larger of the two numbers, every time. This page runs the same computation in your browser when you pick the top level — it takes the machine about a second.

Two things about that result are worth being precise about. First, the optimal policy is not “hold at N” for any N: plotted in three dimensions, the boundary between “roll” and “hold” is a lumpy curved surface — the famous “hump” — that no simple rule reproduces. Second, what the machine knows is a probability, not an outcome. It can play a flawless game and lose it. A solved dice game stays a dice game.

Your chances

This is the friendliest solved game on the site. In Nim the formula decides the winner outright; here the die keeps voting. Against the optimal player a human with any sensible strategy still wins a large share of games — simple heuristics like “hold at 20” give up only a few percentage points to perfection.

So the interesting question is not whether you can beat the expert level — you often will — but whether you can beat it more than the odds say you should. Over one game, luck. Over fifty, still mostly luck: chance alone moves a fifty-game score by about seven percentage points either way, more than the few percent good play is worth. It takes several hundred games for the difference to show.

Who you are playing on each level

Where to go from here