# Guess the hat colors - Riddle 4

And today's puzzle, a freshly made one that I am thinking of adding to my collection, I hope it's challenging enough!

CHALLENGE: Guess the hats of the prisoners.

SPECIAL RULE: There are three types of hats now. There is one multicolored hat, which is both green and black. The rest of the hats are simple black or green.

DESCRIPTION: Each one can see the hats that are in front of them, and not their own. Pay attention to the order, they give tips one by one:

1- A sees 2 prisoners wearing black (1 of them could be the multicolor hat)

2- Only after listening to A can B figure out which hat he is wearing (remember it could be black, green or multicolor)

3- Only after listening to B can C figure out what hat he is wearing.

4- And finally, D can figure out which hat he is wearing. He can only figure it out after listening to C, not before.

You know there is one multicolor hat, but you don’t know how many green and black hats there are of each color (all of them must be wearing one). EDIT: However, all do know the exact amount there is of each type!

Reminder: In order to "know their hat", they must know exactly which of the three types of hat they have, i.e., they must be sure if they're wearing the multicolor hat or a simple one.

Good luck!

• Does the multicolor hat have to be worn, or is it just a possibility? Sep 19, 2020 at 19:28
• There must be one multicolored Sep 19, 2020 at 19:30
• Do we know whether or not A knows their own hat? Sep 19, 2020 at 20:12
• A knows his own hat, but it doesn't really matter. He sees three hats so he will know for sure which one is his Sep 19, 2020 at 20:37
• I can't get As hat
– PDT
Sep 19, 2020 at 20:37

The conclusion is the same as Braegh but the reasons are different.

Let Green be g, Black be b and Multicoloured be m. Well if they know that there are 2b, 1g and 1m and A sees only two black hats, then he cannot be g. So he can be either b or m.

If B was m then A is b. But then B cannot know whether he is m or b from A's statement. Therefore B cannot be m. If B was b and A was m then again B cannot know whether he is b or m. If B and A were B then B would know he was b before A has spoken. So B must be g at least for now. Let us see whether this leads to a contradiction later on or not.

If A is m and B is g then D is b and from this C would not know whether it is m or b so D must be m. Then D can know that he is b. Prior to this As statement would have made him unsure if he was b or g too.

If C can know what his hat is with all the statements so far D knows that he must only be m. He was wondering if he was g, m or b from a's statement, b or m from Bs and so he knows that he can only be M.

Since there is only one solution to this puzzle and these arrangements of hats lead to no contractions with the premises given then A is Black, B is Green, C is Black and D is Multicoloured must be the solution.

• good reasoning and correct conclusion, well done Sep 20, 2020 at 14:37

For B to positively identify his hat, any of the following must be true:

1: A's hat is multicolored, and B's is Green. (If it's Black, he could believe the inverse is true.) 2: A's hat is Green.
3: A's hat is Black, and B's hat is Green. (If it's multicolored, B could think the opposite; as pointed out after my first attempt, if it's Black, B knows his hat without A's input.

Black knows his hat, because between B, C, and D, there is one of each type of hat. Sadly, this leaves C stuck with no information. So this clearly doesn't apply.

In Scenarios 1 and 3: C knows that the hats are MGBB, and thus Scenario 2 does not apply because it would require a different hat distribution. Since B's hat is Green in both scenarios, let's look at D's hat.

It's multicolored. This means we have Scenario 3, and C's hat is Black.

It's Black. This means that either our hat or A's is multicolored. And we don't know which.

By stating C knows his hat color, D also can know the reasoning C has gone through, and know his hat is multicolored.

A's hat is black, B's hat is green, C's hat is black, and D's hat is multicolored.

• Nice reasoning, but rot13(va lbhe fbyhgvba, oynpx/oynpx/zhygvpbyberq/terra, O jbhyq vzzrqvngryl xabj ur vf jrnevat n oynpx ung, jvgubhg univat gb yvfgra gb N. Gura guvf pbzzrag bs lbhef "Vg'f zhygvpbyberq. Guvf zrnaf jr unir Fpranevb 3, naq P'f ung vf gur bccbfvgr bs O'f pbybe. Fnqyl, jr qba'g xabj juvpu." zvtug abg or gehr nalzber: jr qb xabj juvpu) Sep 19, 2020 at 21:03
• Right. This means some tweaking needs to be done; I'd forgotten about the knowledge of the setup at first, and only worked it in later. Sep 19, 2020 at 21:07
• @GuessHat Edited the original. Sep 19, 2020 at 21:18
• He has got the right answer.
– PDT
Sep 19, 2020 at 23:42
• The reasoning might be a little off though.
– PDT
Sep 19, 2020 at 23:45

I'm probably missing something, but I'll put out my current solution to try to think through if I'm missing anything. Easier to do that while explaining.

First things:

B must be able to see the multi-color hat. If he cannot see the multi-color hat, then he cannot know if he is wearing the MC hat, or a solid color. If he can see 2 solid black hats, then his is either green or MC, if he can see 1 solid black and 1 solid green, his hat could be solid green or MC. Therefore if he knows his hat he must be able to see the MC and either a black or a green. If he sees a green, his must be black, if he sees a black, his must be green. Either way, based on what he can see he will know his own hat color.

Using this:

C must have the MC hat. He knows that B must be able to see the MC hat to be sure of his own hat color, and if C can see the MC hat, then he wouldn't know whether his own hat was green or black. That is to say, if he saw that D had the MC hat, he would know that either he or B had a black hat, but he couldn't determine for sure who had which. Therefore he must have the MC hat, and be able to see that D has a solid hat.

However, at this point we run into a slight problem:

We cannot know what color the hats of A, B, or D are, and there's no way for D to know his own hat at this point. D knows that he can't have the MC hat, and that his hat must be the opposite of B, but he doesn't know what color B's hat is, so therefore he can't know his own. Furthermore, none of the clues let us know what A's hat is.

In conclusion:

A's hat is unknown. B and D are opposite solid color hats, but we can't know which is which. C has the multi-color hat.

• The first paragraph of your reasoning is correct, well done. The second one is where you reach a wrong conclusion that leads to all the following wrong reasoning, I believe. This this the point: rot13(Lbh fnvq "naq vs P pna frr gur ZP ung, gura ur jbhyqa'g xabj jurgure uvf bja ung jnf terra be oynpx". V oryvrir guvf fgngrzrag vf jebat, orpnhfr vs P vf terra naq Q vf ZP, gura O jbhyq xabj gung uvf ung vf oynpx fvapr gur ortvaavat, abg bayl nsgre yvfgravat gb N.) Sep 19, 2020 at 20:34

### Reasoning:

Since the multicolor hat must be worn and there is only one, whoever is wearing knows it is his/her hat, since none of the others are wearing the multicolor hat. Since all of B, C and D needed additional information to determine their hat, A must be wearing the multicolor hat.

Based on statement #1:

B, C and D must be wearing 2 black and 1 green hat. But each can now determine the color of their hat by examining the other 2. So statement #2 can be truthful, but statements 3 and 4 cannot.

An alternative:

It might be different if B, C, and D did not know the multicolor hat had to be worn. But it's not. Based on statement #1, we know that B, C and D are collectively wearing either 2 black and 1 green hat, or 1 black, 1 green and 1 multicolored hat. A cannot be wearing the multicolor hat, for if so, all of B, C and D would know their hat color since we are forced into the 2 black and 1 green hat case, and each can look at the other 2 to determine their hat color. Thus B, C, and D must collectively be wearing 1 black, 1 green and 1 multicolored hat.

But the problem is:

Suppose D is wearing the multicolor hat...the argument is symmetric for the others. Then B and C both know that they are in the 1 green, 1 black, 1 multicolor scenario, and both now know that their hat color is the opposite of the other. So C cannot need additional information from B.

• They can't see their own hat, this also applies for the multi-colored hat. It feels like a normal hat on top of them, it just has 2 different colours Sep 19, 2020 at 20:54
• @GuessHat Yes, but if you know someone must be wearing the multicolored hat, and no one else is, then you know you are wearing it. Sep 19, 2020 at 21:17
• But remember they can only see the hats in front of them. For instance, B can only see C and D. Imagine B can't see the multi-colored, he would still not know whether he's wearing it or A is Sep 19, 2020 at 21:53
• Ahhh...I misunderstood the phrase "in front of them". I did not see a particular lineup in the problem statement. Sep 19, 2020 at 22:15
• I'll make sure to make it clear in the future, thanks for the tip Sep 20, 2020 at 14:58

I believe that the solution must be

B=black, C=multicoloured, and D=green. A can't tell his/her hat colour.

Reasoning is as follows. A sees two hats containing black, so the possible hat orderings she sees are:

1) b b g 2) b g b 3) g b b 4) m b g 5) m g b 6) g m b 7) g b m 8) b m g 9) b g m

For B to know his hat colour he must see:

1) two black hats (case 3), in which case he would know he had a green hat. ii) one black hat and one multicoloured hat (cases 6 and 7), in which case he would also know he had a green hat. iii) one green hat and one multicoloured hat (cases 8 and 9), in which case he would know his hat was black. If he sees a black hat and a green hat (cases 1, 2, 4, and 5) he wouldn't be sure if his hat was black or multicoloured. (Note that if he saw two green hats then he would know that A was lying or mistaken and couldn't make any conclusion).

For C to know her hat colour she must see:

a) a green hat (case 8), in which case she knows her hat is multicoloured. If C sees a black hat, she can't distinguish between case 3 (where she would have a black hat) and case 6 (where she would have a multicoloured hat). Similarly, if C sees a multicoloured hat then she can't distinguish between cases 7 and 9 (where she would have a black or green hat respectively)

Now D knows:

only case 8 is possible (as both B and C know their hat colours) so he knows his hat is green.

• Good explanation, but I can see some flaws! B knows how many hats of each colour there are (so does each of the four of them, it's only us who don't know this). So with your solution, B sees one m and one g, so he would know his hat is b without having to listen to A. B only finds out his hat AFTER listening to A. I would suggest taking a look to the first riddle, I think it is easier to grasp the concept: puzzling.stackexchange.com/questions/102172/… Sep 20, 2020 at 14:44

OK - now that I understand that the competitors already know the number of hats of each colour that are used in the game I will try again.

Because there is only one multicoloured hat and A can see only two hats with black in them, there must be at least one green hat. So the possible sets of hats are some orderings of the colours

bbgm and bggm

In each of these sets, there are 12 possible orders the hats could have been given out. I have drawn them in the following table. The first column is the order number (so I can reference them below), the 2nd to 5th columns show the hat colours of A to D respectively, and the 6th to 9th columns show if the respective comments of A to D are impossible (x), possible (o), or known before the previous players comment (b).

With reference to top half of the table. For the first set:

• orders 1,2,3,4,5 and 6 are impossible as A's statement would have been incorrect.
• orders 7 and 8 are impossible as B would have known before A's statement.
• orders 9, 10, 11 and 12 are consistent with B's statement but
• 9 and 10 are impossible as C can't choose between two colour choices.
• 11 and 12 are consistent with C's statement but
• D cant choose between two colours so both are impossible.

With reference to bottom half of the table. For the second set:

• orders 1,2 and 3 are impossible as A's statement would have been incorrect.
• orders 4,5,6 and 7 are impossible as B can't choose between two colour choices.
• orders 8 and 9 are impossible as B would have known before A's statement.
• orders 10, 11 and 12 are consistent with B's statement but
• orders 10 and 11 are impossible as C can't choose between two colour choices.
• order 12 is consistent with C's statement and now
• order 12 is also now consistent with D's statement.

So in conclusion: only the final arrangement (12) for the second set of hats is consistent with all the players statements and the colours are therefore

A=Black, B=Green, C=Black, and D=Multicoloured,

• Someone has already posted an answer that came to the same conclusion, and it is accepted. Please refrain from giving duplicate answers. Sep 20, 2020 at 22:58
• wow that was a thorough reasoning, well done! Sep 21, 2020 at 2:30

Here's how I attempted to do it. Let's denote the multi-coloured hat as m, black hats as b, and green hats as g. Let's now consider a few scenarios.

EDIT: Scenario 3a has been update to reflect the correct answer as per @Guess Hat's comment.

SCENARIO 1

A has the multi-coloured hat.

As such, the 2 black hats that A sees would have to be full, simple black. This implies that there are 2 black hats and 1 green hat. This means that the order of hats (with A starting on the left) could be:

a. m, b, g, b

b. m, b, b, g

c. m, g, b, b

If it is Scenario 1a, then B would not be able to figure out his own hat, since he could either have the multi-coloured hat or the black hat. The same reasoning applies for Scenario 1b.

For scenario 1c, B knows that there are a total of 2 black hats and from A's statement, he cannot have the multi-coloured hat (otherwise A would see 3 black hats). Therefore, B figures out he has the green hat. However, C cannot figure out the colour of their own hat because he wouldn't know whether he has the multi-coloured hat or the other black hat. Therefore, none of these scenarios works.

SCENARIO 2

B has the multi-coloured hat.

If that is the case, then one the black hats that A mentioned must be B's. Since B is able to figure out his hat, then there must only be 1 black hat (otherwise, B wouldn't know whether he has a multi-coloured hat or a black hat). Therefore, there are 1 black hat and 2 green hats. This leads to the following combinations.

a. g, m, b, g

b. g, m, g, b

As mentioned, B can figure out his own hat colour. The question is whether C can. In 2a, C would see that D has a green hat, and therefore he must have one of the black hats in A's statement. However, he wouldn't know whether he has the black hat or the multi-coloured hat (since [g, b, m, g] would also allow B to figure out his hat.

In Scenario 2b, C sees that D has a black hat, so he would reason that he would either have the green hat or the multi-coloured hat. However, if he had the multi-coloured hat, then B would not have to wait for A's statement because he would have figured out on his own that his hat was green (since he sees the multi-coloured hat and black hat in front of him). Therefore, C figures out that his hat was green. However, D would not be able to figure out their own hat colour since he wouldn't know whether his hat was the multi-coloured one or the black one (a scenario like [g, b, g, m] would also allow B and C to know their own hat colours). Therefore, none of these scenarios works as well.

SCENARIO 3

One of C or D has the multi-coloured hat and the other has a black hat.

What this means is one of the two black hats that A saw was the multi-coloured one. The other black hat must belong to either B or one of C or D. Let's consider the case whether one of C or D had the black hat. So, B must thus have a green hat. Since he was only able to figure this out after A's statement, A must have a black hat (otherwise, B would have immediately known his hat was green). This leads to the following combinations:

a. b, g, b, m

b. b, g, m, b

In 3a, C would be able to figure out he has a black hat or a green hat (since if B had the black hat, B would not need to wait for A's statement). D realises that since C managed to figure out his hat colour, he does not have the multi-coloured hat and must have a black hat. Hence, D figures out that he has the multi-coloured hat. Therefore, [b, g, b, m] is a valid solution to this problem. But it is worth seeing other scenarios for completeness.

In 3b, C cannot figure out whether he has a black hat or a multi-coloured one ([m, g, b, b] could also be a potential configuration). Therefore, none of these scenarios works as well.

SCENARIO 4

B has the black hat and one of C or D has the multi-coloured one.

This also means that one of C or D has a green hat. Since B was able to figure out his hat colour, A must have a green hat as well. Therefore, there are 2 green hats and 1 black hat. The possible combinations are:

a. g, b, m, g

b. g, b, g, m

In 4a, C would not be able to tell whether he has the black hat or the multi-coloured hat (since [g, m, b, g] also lets B figure out his hat colour). Therefore, this scenario is not possible.

In 4b, C sees that D has a multi-coloured hat. He reasons that if he had a black hat, then B would have immediately known his hat colour without relying on A (since there is only 1 black hat and 1 multi-coloured hat). Therefore, C figures that B has the black hat and he must have a green hat. D can reason along similar lines and knows B must have either the multi-coloured hat or the black hat. If B had the multi-coloured hat, then we run into scenario 2b. Thus, no matter what, D is unable to figure out his hat colour.

Thus, I conclude that,

A scenario like [b, g, b, m] is the only valid solution.

• Thank you for your detailed explanation. I can see the point that misled you! Look at point 3.a in your answer: bbgm is not an option, because B would know his hat from the beginning, not only AFTER listening to A! Sep 20, 2020 at 14:57
• @GuessHat Ah YES, now I see it! Thanks and cheers! Sep 20, 2020 at 15:07