# Ernest does not know the color of his hat (2)

The previous version indeed proved simple; now a medium one (I think)

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 (each person in a direction along the line, i.e. right or left 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: The person directly before the person directly before me wears a red hat
Bob says: The person directly before the person directly before me wears a green 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?
• Please also provide a valid configuration of people.
• Are you sure this is correct? It looks perfectly symmetric in Anna/red, Bob/green. So whichever configuration works will work equally well after swapping Anna and Bob and all greens for reds and all reds for greens. Oct 5, 2020 at 14:30
• @PaulPanzer I have the same thought, so my conclusion is that E wears yellow hat. But I haven't figured out a valid configuration for that. Oct 5, 2020 at 14:31
• @WhatsUp you're a genius! Oct 5, 2020 at 14:36

## 1 Answer

Credit to @WhatsUp for giving me the crucial hint!

Because of the symmetry in Anna/red Bob/green Ernest's hat can only be uniquely determined if it is yellow. Possible configuration: Ernest and Dennis directly facing each other, Anna and Bob behind Dennis. If Dennis did see a red or green hat because he cannot know whether Anna or Bob are standing directly behind him he would not be able to tell whether Ernest knows his hat. Therefore Dennis must see yellow. What's more Ernest knows this because he sees Anna and Bob are out of Dennis's sight, so he can also conclude his hat is yellow. Re providing a valid configuration, in addition to the constraints spelt out above there are three more obvious ones which follow from Anna's and Bob's statements being true. 1) neither Anna nor Bob can actually stand directly behind Dennis unless they face the other way and 2) each of them must have at least two people in front of them. 3) they cannot face each other with exactly three people in between.

Even with these additional constraints there are lots of valid configurations. Not part of the question but useful for clarity there must be at least one more player.

• Actually it was part of the question, in the form of "Please also provide a valid configuration of people." , that was intended to prevent shortcut answers and force your last observation into any answer. Oct 5, 2020 at 15:33
• What's wrong with shortcuts @Retudin? Also, once the core configuration (A,B,D,E) has been worked out the remaining constraints (making sure A's and B's statements are True) are trivial to meet, don't you think? Anyway, I've added a few words on that. Oct 5, 2020 at 15:52
• Generally, not at all. But I did not want to to get into the discussion that i.m.o. one should not only prove that red and green are impossible, but also that yellow is possible. And that some people might be blindsided by thinking they have to find a ABDE configuration, might make it just a bit less easy. Oct 5, 2020 at 16:45
• @Retudin I think I'm getting your point. Avoiding tedious discussions is perfectly alright ;-) Oct 5, 2020 at 17:29