The aliens’ odd little test
The setup is brutal, but the logic behind it is neat. Ten prisoners are lined up in order, from tallest to shortest, and each one gets either a black hat or a white hat at random.
They can see the hats in front of them, but not behind them. When the alien guard starts the game, they must guess in order, and the only words allowed are black and white. No hints. No tricks with voice. Just the two hat colors.

The catch is simple: if at least nine of the ten prisoners answer correctly, everyone survives. So the group has five minutes to plan something clever before the hats go on.
Why the first prisoner’s answer matters
At first glance, this seems impossible. The back prisoner can see everyone else’s hats, but not his own, so how could he possibly help the rest of the line?
The trick is to use one of the two allowed words as coded information. The video points out that the total number of black hats is no good, because it could be any number. But parity only has two states: odd or even.

So the group agrees on a code. The first prisoner will say “black” if he sees an odd number of black hats in front of him, and “white” if he sees an even number. That first answer may be wrong about his own hat. It does not matter. It is not really an answer. It is a message.
How the chain of guesses works
Once that first clue is out there, everyone else can work backward. Each prisoner counts the black hats they can see and compares that count to the parity they were told to expect.
In the example from the video, the tallest prisoner sees three black hats ahead, so he says “black” to mean odd. Prisoner two also sees an odd number of black hats, so she knows her own hat must be white. That makes the count line up.

Then prisoner three sees an even number of black hats, which tells him his own hat must be one of the missing black ones. Prisoner four hears that, adjusts what she expects to see, and figures out her hat is black too. After that, the later prisoners keep doing the same thing: they compare what they see with the parity they are supposed to be tracking, and every mismatch reveals their own hat color.
It sounds a little slippery at first, but it is really just a moving count. Each correct guess changes what the next person should expect.
Why this saves nine prisoners every time
The whole strategy depends on one sacrifice. The first prisoner has a 50% chance of being wrong about his own hat, because he is using his word as a signal rather than a real guess. But that single coded word gives everyone else enough information to solve their own hats with certainty.
That is the clever part. The group is not trying to make every guess perfect. They are turning one permitted word into a shared rule, and then each prisoner updates the rule as the line moves forward.

So no matter how the hats are arranged, the plan works. One person may lose his own guarantee, but the rest get a sure path to safety. The aliens wanted a test of logic, and the prisoners answer it with a tiny bit of math.



