This puzzle has some pretty high stakes – One wrong guess and all the prisoners die!

**What is the Prisoners and Hats Puzzle**

This is one of the most famous riddle in the Hat Puzzle category. It’s a story about four prisoners accused of some crime, but the problem is the jail is full so the warden comes up with an idea. He’ll have the prisoners solve a puzzle. If they win, they go free, if they fail they will be executed. Three of the prisoners are made to stand in a line – B is facing a wall, C has B in front of him, while D is last and can see both B and C. Poor A is placed is an another room so he cannot see anyone or be seen. The warden explains he will give them 4 party hats, two white and two black. The prisoners can not see the hats on their own heads. If any of them feels confident that he knows the color of his own hat, he only has to say it out loud and they all walk. Can they save their lives?

** **

**How to Solve the Prisoners and Hats Puzzle**

Poor A is pretty much useless since he is isolated, so it’s up to the other three to find a solution. B is staring at a wall, so he doesn’t know anything either. Their lives depend on C and D. There are two possible solutions. Remember that D has a vantage point as he can see the heads of both B and C. If their hats are both black, it’s obvious that D must be wearing a white hat so he can cry out the answer and save everybody. The game assumes that all prisoners are smart and have the same reasoning skills, so they will wait to see if D has the answer. If they don’t hear anything, C will realize that he and B must be wearing hats of different colors, which explains why D wasn’t able to figure out the color of his hat. Now, all that C has to do is look at B’s hat. If it’s black, this means that he is wearing a white one and he gets to save their skins.

** **

**Prisoners and Hats Puzzle Variants**

There are variants in which there are more or less prisoners and the number of hats of each color vary accordingly, but they generally follow the same logic. The most interesting is that with 10 prisoners and 10 hats, either red or blue, but they don’t know how many of each color are there. They are lined single file and they can see all the hats in front of them, but not behind, obviously. It’s an each for his own game and there is a simple solution for 9 of them to survive, while the other one will have to guess so he has a 50/50 chance to survive. Can you figure it out?