100 wicked people find themselves at the gates of hell. A devil is there to greet them, and tells them they have a chance escape their fate and go to heaven instead, but they must first play a game.
He explains that he will line them all up in a straight line, with each person facing the back of the next one in line. The order will be chosen at random.
He will then place a white or black hat on each person at random. There are no mirror, so noone will see their own hat.
Each person can see the hats of the people in front of them. Everyone can hear everyone else.
The devil will simply ask each person, from back to front, the color of their hat. They may only respond “black” or “white”, with no other information or intonation. No other communication is possible. Those who answer correctly will be sent to heaven. Otherwise, it’s straight to hell.
The devil wants it to be a fair game, and allows the people to devise a strategy before the game begins. One person proposes that everyone says “white”, and that it will save half the people. “No,” says another person. “There’s no guarantee that half the hats will be one color.”
After a quick debate, one person smiles and says, “I’ve got a plan that is guaranteed to save 99 of us, maybe all of us.”
What is their plan?