# Guess the hat colors - Riddle 1

I have created several riddles with my brother, and one of my favourite ones is this one. It is based on the classic prisoner hat riddle, but it has a twist.

TASK: You have to guess which ones are wearing green hats and which ones are wearing black:

DESCRIPTION: A, B and C can see the hats of their two mates, but not their own hat. Pay attention to the order, they give tips one by one:

1- A can see the hats B and C are wearing, but he doesn’t know what hat he’s wearing

2- After listening to A, C figures out which hat he must be wearing (he doesn’t know before listening to A)

3- Finally, D, who is hidden behind a wall and can’t see anyone, figures out what hat he is wearing, just by hearing what A and C have said.

You don’t know how many green and black hats there are of each color (4 in total, all of them must be wearing one), but they do know how many hats there are of each color. For example, if B were the only black hat, A would know his hat is green.

We already know B is wearing a black hat. You have to guess A's, C's, and D's hat! There is only one possible solution

• This isn't exactly a 'modest' puzzle. – Prince Deepthinker Sep 18 '20 at 2:16
• @bobble A little ruthless with the edits eh? – mjjf Sep 18 '20 at 4:23
• @GuessHat just wanted to mention that the picture is much appreciated. I don't see many on here with graphics. – mjjf Sep 18 '20 at 16:31

There are not one or four black hats. In either case, A would know his hat color immediately.

Then:

If there are two black hats, for A to not know his hat color, C must be wearing a green hat. Likewise, if A is wearing the second black hat, C can deduce his own hat is green without A's input. Therefore, A and C's hats are both green. D knows from both A and C that their hats are the same color, in this way. I fail to see how D deduces his own hat color, in this line, though; if he cannot see B, he does not know whether it is black or green, so this does not work out.

In the case where there are three black hats: neither A nor C can see the single green hat. A's statement tells C that he is not wearing the green hat, leading him to claim that he knows his hat color. Now, let's look at D: he learns from A that neither B nor C is wearing the green hat, and from C that A isn't either. Therefore he must be wearing the green hat.

Thus:

A, B, and C's hats are black. D's is green.

• rot13(N, O, naq P znxr frafr, ohg jbhyqa'g vg fgvyy or nzovthbhf sbe Q? Va beqre sbe guvf gb or hanzovthbhf, Q zhfg xabj gung P qvqa'g nyernql xabj gurve ung pbybe orsber gurl fcbxr. Q pbhyqa'g xabj gung jvgubhg cevbe xabjyrqtr bs P, be gryrcngul. Q pbhyq nffhzr vg V fhccbfr.) – mjjf Sep 18 '20 at 4:22
• I think you're right on that, but I also think the implication would be that ROT13(gurer vf ab fbyhgvba), given the other scenario? – Braegh Sep 18 '20 at 11:10
• The reasoning is perfect, I wouldn't have been able to explain it better!!! I just posted a more difficult one, I bet you can't resolve it as quick this time... Good luck! puzzling.stackexchange.com/questions/102187/… – Guess Hat Sep 18 '20 at 14:55
• @GuessHat if this is right, please mark it as the accepted answer. – mjjf Sep 18 '20 at 16:06
• @GuessHat Yeah, I suppose if I was D I would interpret it that way. It wasn't clear that he knew that for a fact beforehand, but I can see it being the more likely conclusion after hearing the others' discussion. – mjjf Sep 20 '20 at 1:09