Previously I tried to make a very difficult hat color deduction puzzle: Unseen prisoners figuring out their hats
It seems to be too hard for the interested, since I did not get a complete solution.
The central part of the logic was that the statement "Ernest does not know the color of his hat" told Ernest the color of his hat. Below the simplest of such a problem I can think of:

The (same) premise: A number of people stands on a line playing a hat guessing game

  • they may not move during the game, they can only look straight ahead (in one direction along the line, depending on their facings)
  • they all wear a yellow, a red or a green hat.
  • they see all people in front of them
  • they do not know their own hat
  • they do not know anything about the configuration behind them, except which people are there, and what is deduced from the content of the statements
  • all statements are provably true for the person uttering them

Anna says: Everyone in front of Dennis wears a green hat
Bob says: Everyone behind Dennis wears a red hat

then Dennis says: Ernest does not know the color of his hat
then Ernest says: I know the color of my hat

What is the color of Ernest's hat?

  • $\begingroup$ Bob is in front of Dennis, but facing him. $\endgroup$ Commented Oct 5, 2020 at 12:44
  • $\begingroup$ "depending on their facings" (plural) is supposed to tell that different persons can look in different directions $\endgroup$
    – Retudin
    Commented Oct 5, 2020 at 12:57

2 Answers 2



Ernest's hat is green.


From the first two statements, we (and Ernest) know that Ernest's hat is either red, or green depending on whether he is in front of or behind Dennis. If he was facing Dennis he would immediately know the colour of his hat, but Dennis, who is facing Ernest, sees that Ernest is facing away and asserts that Ernest does not know the colour of his hat. Ernest knows that Dennis would only be able to make such a statement if he was able to see him, and therefore, Ernest is in front of Dennis and his hat must be green.

  • $\begingroup$ I consider this a slightly better answer: For the answer to the question the position/facing of Anna and Bob does not matter at all, and this answer is more compact because of it $\endgroup$
    – Retudin
    Commented Oct 5, 2020 at 13:04


Ernest's hat is green.


Anna must be standing behind Dennis and facing him, while Bob is standing in front of Dennis and facing him. From their statements, anyone who can see Dennis knows which way he's facing and knows their hat color. Anyone (except Dennis) who can't see Dennis but can see a neighbor's hat knows that they have the same hat color as their neighbor.


If Ernest doesn't know his hat's color, he must be at either end of the line, facing outwards. Dennis can only know this if he's facing Ernest.


Ernest now knows that Dennis can see him, so he knows that he's in front of Dennis, and by Anna's statement knows that his hat is green.


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.