20 December 2015

# Puzzle time! Of colored hats and blindfolded people…

It has been a long time since I posted a puzzle. This is a variation of those category of logic problems where blindfolded people regularly get colored hats put on them and they have to guess the color of the hat on their own head đź™‚

This particular one goes this way – Twelve sailors get marooned in an island. The local tribe finds them out and takes them to their leader. Their leader, not knowing what to do with the prisoners, come up with a novel idea. He tells them that next day morning, he was going to line them up in a straight line and put a cap on their head while they are blindfolded. The only colors he has his hats in are black and white. (I do not have the faintest idea why on Godâ€™s green earth the tribal leader had black and white hats, but that is what he had đź™‚ ) After that, he wouldÂ remove everybodyâ€™s blindfold. Then, every sailorÂ couldÂ see the color of the hats of all the people in front of himself but not his own or that of the ones behind.

The leader wouldÂ start from the last person in the rear and ask him to name the color of the hat he wasÂ wearing. He couldÂ only say â€śBlackâ€ť or â€śWhiteâ€ť. Any other words spoken wouldÂ result in everybody getting killed. If the person gotÂ the right answer, he wouldÂ be spared, else he wouldÂ be killed. Then the leader would move to the next person who was ahead of the last person and go thru the same procedureâ€¦ till he wasÂ done with all twelve of them.

You can assume that everybody can hear the answer given by the person being asked. All the people who were spared would be given a boat and shown how to go back to their land.

Tonight, the sailors have to come up with a strategy to save as many of themselves as they can.

What would be the best strategy to maximize the number of people who can survive? How many can survive?

Posted December 20, 2015 by Rajib Roy in category "Puzzles

1. By Rupa Bamba on

The best strategy would be for the 12 sailors to get their captors drunk at night and divulge the way back to land, then grab the boat and set sail. Tribal leaders have strange humors – who is to say that the despot won’t change his mind and have them bumped off, regardless of their answers?

2. By Debajyoti Roy on

Interesting! I have a staright forward solution to save 6 sailors for sure and remaining 6 have a 50% chance of life. Lets see if we can improve that đź™‚ Rajib Roy

3. By Rajib Roy on

Debajyoti, I assume your approach is like Natasha’s. In her case too, the even person from the end would get saved and for the other six it would be 50-50 chance. That is a good solution. But it is possible to save more people…

4. By Rajib Roy on

Rupa, and they can always use the drink from my post previous to this to accomplish your strategy đź™‚

5. By Debajyoti Roy on

Natasha’s solution will save 1 prisoner (the prisoner at the beginning of the q) for sure and the rest are 50% chances I guess, isn’t it?

6. By Rajib Roy on

No, I think her approach is the following – last one yells out the color of the hat in front of him. HE himself has a 50-50 chance of that being his color too but for sure, the guy in front of him now knows what is his color. You extend that logic for every pair of guys…

1. By Rajib Roy on

You do realize that it is not the same outcome, right? This approach saves half the people for sure. The odd even saves all but one for sure.

7. By Debajyoti Roy on

dividing in groups of 3 and the last person in each grp can call out depending on the 4 combinations possible for the remaining 2 ahead.

8. By Anu Sahai on

If there is no restriction on how “black” or “white” are said, could save 11 at least, with the last having a 50% chance:)

9. By Rajib Roy on

Anu, if I understand your question, you are asking not how they pronounce black or white but do they have full freedom to yell whatever they want? If so, the answer is yes. And 11 is the correct answer!!

10. By Ram Narayanan on

….in the prevailing public sentiment, calling out “black” and “white” on anything and esp with ref to prisoners is fraught with risks of misunderstanding, so I respectfully recuse myself from this problem..

11. By Rajib Roy on

Anu, now I understand the question. No, the tone, timing, etc have nothing to do with it. This is not a trick question, pure logic.

12. By Anu Sahai on

So the last person calls out the color of the guy in front of him (50/50 chance of his survival), now the next guy yells his own color if the guy in front of him has the same color or whispers it if the guy in front of him has the opposite. That way 11 are def saved!

13. By Rajib Roy on

The crux of the logic lies in telling the person in front of you something that the person can use to â€śdiffâ€ť against what he sees. Obviously, it cannot be the number of black or white. Since by saying â€śBlackâ€ť or â€śWhiteâ€ť, you can only signal two numbers. But what you can do is signal â€śevenâ€ť or â€śoddâ€ť. So, if you signal to the person in front of you that you see odd number of white hats (by saying â€śWhiteâ€ť, letâ€™s say), the person in front can now check whether he sees odd or even number of white hats in front of him and therefore deduce his answer. And from his answer, coupled with your answer the people in front of him can deduce whether there is even or odd number of white hats in front of the person in front of you and so on.

So, letâ€™s see how it will work. The strategy they come up with is the following: The last person in the line (the first to be asked) will call out â€śWhiteâ€ť if he sees odd number of white hats in front of him. And that is all that is required.

Letâ€™s say that person called â€śWhiteâ€ť. Well, it is 50-50 chance that he has White. That is about pure luck. But the person in front of him knows that the last person saw odd number of White hats. If he himself sees odd number of white hats in front of him, he calls â€śBlackâ€ť correctly. And the people in front of him know that from the third last person onwards, there are still odd number of white hats left. So, the third last person counts the number of white hats in front of him and then correctly calls his own. Of course, if the second person had seen even number of White hats in front of him, he would have called â€śWhiteâ€ť and everybody would now know that there are even number of hats left and so on…

So, the generic logic for every person other than the last one is the following:

1. Start by saying to yourself â€śEvenâ€ť
2. Now, everytime you hear somebody behind you yell â€śWhiteâ€ť, toggle your mental count. So, if you were â€śEvenâ€ť, tell yourself â€śOddâ€ť and vice versa.
3. And when it is your chance, see whether you see even or odd number of white hats in front of you. If your mental count and your visual count match, you have Black, else White.

11 of them can be saved for sure. The last person in the queue is a 50-50 chance.

14. By rajibroy (Post author) on

The crux of the logic lies in telling the person in front of you something that the person can use to â€śdiffâ€ť against what he sees. Obviously, it cannot be the number of black or white. Since by saying â€śBlackâ€ť or â€śWhiteâ€ť, you can only signal two numbers. But what you can do is signal â€śevenâ€ť or â€śoddâ€ť. So, if you signal to the people in front of you that you see odd number of white hats (by saying â€śWhiteâ€ť, letâ€™s say), the person in front can now check whether he sees odd or even number of white hats in front of him and then deduce his answer. And from his answer, coupled with your answer the people in front of him can deduce whether there is even or odd number of white hats in front of the person in front of you and so on.

So, letâ€™s see how it will work. The strategy they come up with is the following: The last person in the line (the first to be asked) will call out â€śWhiteâ€ť if he sees odd number of white hats in front of him. And that is all that is required.

Letâ€™s say that person called â€śWhiteâ€ť. Well, it is 50-50 chance that he has White. That is about pure luck. But the person in front of him knows that the last person saw odd number of White hats. If he himself sees odd number of white hats in front of him, he calls â€śBlackâ€ť correctly. And the people in front of him know that from the third last person onwards, there are still odd number of white hats left. So, the third last person counts the number of white hats in front of him and then correctly calls his own. Of course, if the second person had seen even number of White hats in front of him, he would have called â€śWhiteâ€ť and everybody would now know that there are even number of hats left.

So, the generic logic is for every person is

1. Start by saying to yourself â€śEvenâ€ť
2. Now, everytime you hear somebody behind you yell â€śWhiteâ€ť, toggle your mental count. So, if you were â€śEvenâ€ť, tell yourself â€śOddâ€ť and vice versa.
3. And when it is your chance, see whether you see even or odd number of white hats in front of you. If your mental count and your visual count match, you have Black, else White.

11 of them can be saved for sure. The last person in the queue is a 50-50 chance.

This site uses Akismet to reduce spam. Learn how your comment data is processed.