Chomp is a two-player game played on a chocolate bar with one poisoned square in the corner. Each bite takes a square and everything below it and to its right, and whoever is left with the poison loses. Here you play it against a computer that has worked out every position, or against a friend on the same screen.
The rules of the Chomp game
The bar starts as a full rectangle, with a skull on the poisoned square in the top-left corner. On your turn, choose any square that's still there, other than the poison. You eat that square and every square below it, to its right, or both. Then it's the other player's turn.
Because every bite takes a corner off what's left, the bar always looks like a staircase, with rows that never get longer going down. The game ends when only the poisoned square is left: the player who has to face it loses, and the player who took the last bite wins. There's no luck and no draw.
Bar sizes and who bites first
Under Bar size, choose Small, 4 rows by 5 columns, Medium, 5 × 7, or Large, 7 × 9. A Small game takes a minute or two, and the Large bar, with 63 squares, gives both players a lot more to think about.
Against the computer, First bite decides who starts, and it matters: on every bar here, the first player can always win with perfect play. In 2-player mode Player 1 bites first, so swap who starts each game.
Playing the computer or a friend
Choose Computer or 2 players under Opponent. The computer has three levels:
- Easy goes for a winning bite only about 1 time in 4 and otherwise bites at random.
- Medium finds the winning bite about 2 times in 3, and every time once 10 or fewer squares are left.
- Hard has worked out every shape the bar can reach, so it never misses a winning bite. When it has none, it eats a single square as far from the poison as it can and waits for a slip.
Hard can't lose when it bites first. Take the first bite yourself and you can beat it, but only by finding the one winning bite and never slipping after that. Two-player games and each computer level keep separate scores.
Picking a bite with a tap, a mouse, or the keys
Tap or click a square to pick it, and the squares that would go light up. With a mouse you see them as soon as you hover. Tap Eat, or the same square again, to take the bite.
- Keyboard: Tab to the bar, move with the arrow keys, and press Enter to pick and Enter again to eat. Escape clears your pick, H shows a hint, U undoes, and N starts a new game.
- Screen readers: each square is read out with its row, its column, and how many squares a bite there would eat, and every bite is announced.
- Undo: takes back your last bite, and against the computer its reply too.
Why the first player always wins the Chomp game
On any rectangle bigger than a single square, the first player can force a win. The proof uses an argument called strategy stealing. Suppose the second player had a winning plan. The first player opens by eating only the bottom-right square, and the second player answers with some winning bite.
But every bite eats the bottom-right square anyway, so that answer leaves a bar the first player could have made with one opening bite of their own. Then the first player would be the one following the winning plan. That's a contradiction, so the second player can't have a winning plan, and the first player must.
The proof never says which bite wins. It only shows that one exists, which is why it's called a non-constructive proof.
No general rule, but one winning first bite per bar
For a general rectangle, nobody has found a rule that says where to bite. A computer can find the answer for one bar by checking every shape it can be eaten down to, but the count grows fast: a 7 × 9 bar can already be eaten into just over 11,000 different staircases. The computer here works through all of them.
Each of the three bars has exactly one winning first bite, and it's bigger than you might guess. It eats 6 squares on the Small bar, 20 on Medium, and 30 on Large. Every other opening loses against perfect play, and Hint shows the winning bite whenever there is one.
Shapes you can solve: L shapes, squares, and two rows
A few shapes do have simple answers, and they come up during real games:
- Equal L: when only the top row and the left column are left, with arms of the same length, the player to move loses. Whatever they eat from one arm, copy it on the other.
- Square: the player facing a square bar wins by biting at row 2, column 2, which leaves an equal L.
- Two rows: with two rows left, the player to move loses exactly when the top row is one square longer than the bottom. Facing two equal rows, eat the bottom-right square.
- One row or one column: eat everything except the poison.
The two-row rule holds up because you can always restore it. If your opponent shortens the bottom row, cut the top row back to one square longer. If they shorten the top row, the rows end up equal, and eating the bottom-right square brings back the one-square gap. Sooner or later the bottom row is empty and the top row is just the poison.
On the Small bar, eating the whole last column looks harmless, but it leaves a 4 × 4 square, and your opponent wins by biting at row 2, column 2.
Beating each computer level
- Easy takes a sure win only now and then, so even a shaky bite usually survives. Practice the shapes above on it until leaving an equal L feels automatic.
- Medium is beatable on a big bar, but once 10 or fewer squares are left it never misses a winning bite. Reach a losing shape for it before the bar gets that small.
- Hard can only be beaten if you bite first. Use the hint on the opening bite, and press it again whenever you're unsure, since every reply after that has to be a winning one too.
- When no bite wins, eat one square at a time from the far corner. Easy and Medium bite at random when they miss, so a longer game gives them more chances to slip.
Where the Chomp game came from
The chocolate-bar game was devised by David Gale, a mathematician at the University of California, Berkeley. Martin Gardner wrote about it in his Mathematical Games column in Scientific American in 1973 and gave it the name Chomp, and Gale published his own article, A Curious Nim-Type Game, in 1974.
The same game had already appeared in another form. In 1952 the Dutch mathematician Frederik Schuh described a game of choosing divisors of a number, where you may not pick 1 or a multiple of a number already chosen. Take 12: its divisors 1, 2, 4 and 3, 6, 12 fit in a 2 × 3 grid, and choosing one rules out all its multiples, just as a bite takes the squares below and to the right. The number 1 plays the poison.
Like Nim, Chomp gives both players the same moves, and Hex uses the same strategy-stealing proof to show that the first player wins.
What's saved between visits
No account is needed. The page needs a connection to load, and after that Hard's search through every staircase, and every hint, runs in your browser. Your bites and scores aren't sent to a server.
The bar you're partway through, your settings, and a score against each computer level and for two players are kept in this browser's local storage. Close the tab mid-game and the same staircase is waiting later. Reset scores clears every score, and the privacy policy lists the rest.