enter image description here

A warden lines up these prisoners. He announces, "I see a white hat." He then leaves the room. Every few minutes he comes back in and asks if anybody knows their hat color. Anyone who figured it out before the warden came back must announce "I do", after which he is freed. Everyone else must remain silent until the next visit. After a prisoner is freed, everyone else will know who was freed.


  • each prisoner knows that there are 8 prisoners (including themselves), each with a hat, lined up in this orientation
  • each prisoner can see the hat color of all the prisoners in front of them (not their own or those behind them)
  • the prisoners cannot move or communicate at all, beyond announcing to the warden that they know their hat color
  • each prisoner is a logician

Who (if any) figures out the color of their hat, and when?

  • 1
    $\begingroup$ There is insufficient information provided here. Do the prisoners know how many hats of each color there are? $\endgroup$ Apr 17, 2019 at 18:33
  • $\begingroup$ @JeffZeitlin EDIT: They know that there are 8 hats, but not how many of each color $\endgroup$ Apr 17, 2019 at 18:33
  • $\begingroup$ Doesn't change the logic. $\endgroup$ Apr 17, 2019 at 18:39
  • $\begingroup$ Do the remaining prisoners know who has figured out his hat, if behind him? $\endgroup$ Apr 17, 2019 at 18:55
  • 10
    $\begingroup$ Three logicians walk into a bar. The bartender asks, "Do you all want a drink?" The first one says "I don't know", the second says "I don't know", and the third says "Yes" $\endgroup$ Apr 17, 2019 at 22:11

2 Answers 2



This is a variation on the blue-eyed islanders puzzle, with the added condition that some people can't see others.

If prisoner 1 saw only black hats, he'd know that his own hat was white and announce that on the warden's first visit. Since he doesn't do this, all prisoners now know that there is at least one white hat among prisoners 2-8.

If prisoner 2 saw only black hats, and if prisoner 1 hadn't been freed on the first visit, then he'd announce that his hat was white on the warden's second visit. Since he doesn't do this, all prisoners now know that there's at least one white hat among prisoners 3-8.

Following this logic, on the seventh visit, all prisoners know that there's at least one white hat among prisoners 7-8. Prisoner 7 sees a black hat and knows that his own hat is white. From this prisoner 8 knows that his hat is black on the eighth visit.

The remaining prisoners will never have enough information to deduce their hat color. In general, the only prisoners who can deduce their hat color are the rightmost white-hatted one and the prisoners to his right.

(If the warden is feeling generous, he can say, "I still see a white hat" on each visit and all the prisoners will eventually be freed.)


The above assumes that the prisoners know that the hats are either black or white. That's not true in the puzzle as written - so prisoner 8 won't be freed; he knows that his hat isn't white but can't deduce what color it is.

  • 1
    $\begingroup$ Nice! That was very fast, I guess my riddle isn't very good, haha. But you got one small thing wrong. I'm still inclined to accept this, because you did all the important logical legwork. But you're making one small assumption that I didn't provide. $\endgroup$ Apr 17, 2019 at 19:08
  • $\begingroup$ perhaps that they don't declare the color of their own hat, but merely that they know what their hat color is? $\endgroup$
    – Ben Barden
    Apr 17, 2019 at 19:18
  • $\begingroup$ Your edit is correct! $\endgroup$ Apr 17, 2019 at 19:52

Since the prisoners do not know how many hats of each color there are, none of them can determine their hat color. The first prisoner (at the right) has no information other than that he is wearing a hat, and that he's first in line. The second prisoner knows that there are people behind him, and that he sees a black hat, but he has no way of knowing whether he has a white or black hat, because the white hat that the warden sees could be behind him, or it could be his. The other prisoners all see both black and white hats, but since they don't know how many of each there are, none of them can be sure of the color of the hat they are wearing.

  • 1
    $\begingroup$ Sorry, I edited my comment, and added a fourth bullet point. Each prisoner knows how many hats there are, and they know that they are in the given lineup. But they don't know how many hats of each color there are. Maybe that new information updates your answer. $\endgroup$ Apr 17, 2019 at 18:39
  • $\begingroup$ Nope, doesn't change the logic one whit. $\endgroup$ Apr 17, 2019 at 18:40
  • $\begingroup$ Note that the prisoners do know that there is at least one white hat. ("I see a white hat"). They are not totally ignorant about the number of hats of each color. $\endgroup$
    – Florian F
    Jun 23, 2022 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.