The Prisoner's Hats

In an effort to encourage reader participation, I bring to you my first ever blog riddle. This riddle was told to me by Mike Metcalfe over dinner during the March meeting.

There was an evil king that wanted to kill 4 of his subjects, but worried that there would be an uprising if he simply had them executed, he decided to provide them with a way to escape their fate. What he did was to bury each of them in the ground up to their neck and he put a white or black hat on each of them. One of the subjects was placed behind a wall, so that he was not visible to the others. Example configuration: The Prisoner's Hats

Each prisoner could now only see what was in front of him. The king told the subjects that two of them were wearing white hats and two were wearing black hats, and if one of them could shout out the color of his own hat, all four of them would be set free. If any of them said something other than the color of his own hat, they would all be killed.

How do the prisoners escape?

The solution will be posted in the comments about a week from now, if someone out there doesn't post it first. UPDATE: Solution now available in the comments.

18 Responses to The Prisoner's Hats

  1. 16 Martey March 25, 2006 1:13:am

    I would answer, but I heard this riddle during an interview about a month ago. As a result, I will not say anything.

  2. 17 Phyllis March 27, 2006 11:36:am

    Blake, I think you have stumped the internet. What's the answer?

  3. 18 Blake April 3, 2006 12:04:pm


    Since there are 4 hats and 2 of each color, at least two hats to the left of the wall are the same color. If the two prisoners closest to the wall on the left have the same color hat, the guy in the back knows that his hat is the opposite color, so he can shout out the color of his hat. If the prisoner in the back remains silent, then the middle prisoner knows that the guy in the back does not see two hats of the same color in front of him. Consequently, the middle prisoner knows that his hat is the opposite color of the hat in front of him. So, he can shout out the color of his own hat.

  4. 19 DA Carlson April 5, 2006 6:24:pm

    That was very difficult. I was wracking my brain for a week trying to figure it out. It's a good one though.

  5. 33 ron January 26, 2007 12:46:pm

    umm doesent make sense!

  6. 34 Blake January 29, 2007 1:38:am

    @Ron: what doesn't make sense? The riddle or the solution?

  7. 37 Edwin Cho March 26, 2007 8:52:am

    Can you shout

  8. 38 Blake March 27, 2007 12:51:pm

    @Edwin: if a prisoner shouts something other than the color of his own hat, the king kills him.

  9. 45 Shoe July 12, 2007 2:14:pm

    This is impossible.... =(

  10. 49 ANON October 27, 2007 11:47:am

    This is pretty simple. Just set up a chart and don't worry about who is behind the wall. The only combinations are BWW-Option 1The back prisoner see's two whites and guesses black since there are only four hats, 2 of each color. WBW-Option 2The first prisoner remains silent. Because he is silent the second prisoner knows his hat can not be the same as the one in front of him. If he was the same as the prisoner in front of him, the first prisoner could have easily guessed as in option 1. Since he know's he is not the same hat color as the prisoner in front of him, he guesses the opposite of his color WWB-same as option 2 WBB-same as option 1 BWB-same as option 2 BBW-same as option 2

  11. 2688 caitlyn July 7, 2009 11:17:pm

    wow that is hard nice one

  12. 2703 ben July 15, 2009 4:00:pm

    AAgh! so simple but so annoying! Thanks for the infuirating answer.

  13. 3810 brandon May 28, 2010 9:07:pm

    its pretty comfusing-- make more though

  14. 4881 Daya February 4, 2011 6:25:am

    Out-of-box thinking..

  15. 5921 tyla November 14, 2011 2:13:pm

    none of this is making sense to me at all!! I'm not with it today! whats the answer to the puzzle? simple words though because i reallllly dont get it! sorry!x

  16. 7552 mehdi March 24, 2012 7:43:pm

    it still doesnt make sense.....even if the middle person can guess the colour of his hat correctly how does the person behind him and in front of him after guess the colours of their hats??? the answer given isnt complete

  17. 7577 Blake Johnson March 25, 2012 10:51:pm

    @mehdi: The setup of the riddle is such that only one prisoner must be able to figure out the color of his hat.

    The prisoner in the front can never know the color of his hat, and the prisoner in the back only knows his hat color for particular configurations.

  18. 28255 Berman February 16, 2013 6:27:pm

    Only problem with your solution is its predicated on the middle prisoner knowing the back prisoner can see the two in front. If that's the case then they can all turn their heads to see everyone then the solution would simple be the prisoner that sees two hats of the same color shouts out.

    The riddle explicatly states they can only see directly infront. Thus the middle prisoner has no idea if the man behind him can see him or not.

Leave a Reply