Each player sees every hat in front of them, but not their own hat and not the hats behind them.
Starting from the back of the line, each player in turn says one word aloud, “black” or “white”, which everyone hears. Nothing else may be communicated.
The players agree on a strategy beforehand.
What is the largest number of correct guesses they can guarantee, and how?
💡 Hint
The back player’s word is free, since nobody can see that hat. Make it a summary of every hat in front, so each later player has only one unknown left.
Reveal answer
They can guarantee 9 correct guesses: the back player announces the parity of the black hats ahead, and everyone else deduces their own color.
Step-by-step solution
- Agree that the back player will say “black” if they see an odd number of black hats in front of them, and “white” if they see an even number. Their own guess is a coin flip.
- The second player from the back counts the black hats in front of them. If the parity they see differs from what the back player announced, their own hat must be black. If it matches, their hat is white.
- Every later player keeps a running tally. They know the announced parity, they have heard every guess from the players between them and the back (all of which are correct), and they can see all the hats ahead. Only one hat is unknown, their own, and parity decides it.
- So players 2 through 10 are always right. Only the back player can be wrong.
- Nine is the best possible, since nobody sees the back player’s hat. We checked all 1,024 hat assignments by computer: this strategy gets at least 9 right every time.
Why it fools people
The puzzle tricks you into thinking about individual hats, because each player cares only about one hat. The breakthrough is to send a summary of the whole line instead. Parity is a perfect summary: a single bit that changes whenever one hat changes. Once that bit is public, each player’s own hat is the one missing piece of a simple equation.
Did you get it?
About This Puzzle
A summer camp counselor runs a game on the last night of the season. Ten campers stand in a single-file line, all facing forward, and each gets a hat that is either black or white. Nobody can see their own hat. The campers have one chance to agree on a plan before the hats go on, and after that they can only speak one word each when asked. A correct guess earns a point for the team. Random guessing would score about five. The question is how well a clever team can do, not on average, but guaranteed, no matter how the hats are handed out.
How to Think About It
Think about the player at the very back. Nobody can see that player’s hat, so their guess is pure luck, no matter what the plan is. That means the best possible guarantee is nine. The question is whether the back player’s single word can be used to give everyone else all the information they need. The back player sees nine hats, and one word can carry one bit of information. Ask which single fact about those nine hats would let every other player deduce their own color, provided they listen carefully to every word that follows.
Common Traps
A popular plan is to pair up: the back player says the color of the hat directly in front, so the second player is guaranteed to be right, and so on in pairs. That works, but it only guarantees five correct guesses, because each pair sacrifices one player. Another tempting idea is that players can do better by guessing the majority color, but majorities give no guarantee at all. Some solvers also assume nine is impossible because the back player can only send one word. One word turns out to be enough.
Where This Puzzle Comes From
Hat puzzles are a well-known family in recreational mathematics, and this line version circulates widely among mathematicians and in technical job interviews. The idea at its heart is the same one behind check digits and the extra bits computers add to detect errors when data is stored or sent. This retelling uses an original summer camp setting, and its rules are fully spelled out so that the answer can be proved rather than guessed.
Try This Variation
Same game, but now each hat can be red, white or blue, and each player says one of those three words. Can the team still guarantee the same number of correct guesses as before?
Show the answer to the variation
Yes. Number the colors 0, 1 and 2. The back player announces the color matching the sum of the nine hats ahead, modulo 3. Each later player knows that total, sees the hats ahead and has heard the correct guesses behind them, so their own hat is the only missing number.
