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

28 COMMENTS :

  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?

    Reply
  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

    Reply
  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…

    Reply
  4. 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?

    Reply
  5. 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…

    Reply
    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.

      Reply
  6. 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.

    Reply
  7. 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:)

    Reply
  8. 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!!

    Reply
  9. 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..

    Reply
  10. 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.

    Reply
  11. 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!

    Reply
  12. By Rajib Roy on

    Answer to the puzzle:
    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.

    Reply
  13. By rajibroy (Post author) on

    Answer to the puzzle:
    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.

    Reply

Leave a Reply to Debajyoti Roy Cancel reply

Your email address will not be published. Required fields are marked *


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