Back to Logic Problems

Prisoners and Hats
This Hard puzzle in the “logic” category rewards careful reading and step-by-step reasoning. Use the hint if you are stuck, then compare your approach with the explained answer.
A group of prisoners is lined up so that each prisoner can see the hats of everyone in front of them, but not their own hat and not the hats behind them.
Each hat is either black or white.
Starting from the back of the line, each prisoner must say out loud either “black” or “white” as a guess for their own hat color.
They may not say anything else.
Before being lined up, the prisoners are allowed to agree on a strategy.
What strategy lets them guarantee that all but at most one prisoner survive?
Preparing…