The Prisoners Black and White Hat Riddle


Problem :

Suppose there are 4 prisoners named A, B, C, and Z. Prisoner Z is standing on one side of a wall, and prisoners A B and C are standing on the other side of the wall. Prisoners A, B, and C are all standing in a straight line facing right – so A can see prisoner B and C, and B can see prisoner C. This is what their arrangement looks like:

Z | A B C
Where the “|” represents a wall. The wall has no mirrors. So, prisoner Z can see the wall and nothing else.

There are 2 white hats and 2 black hats and each prisoner has a hat on his head. Each prisoner can not see the color of his own hat, and can not remove the hat from his own head. But the prisoners do know that there are 2 white hats and 2 black hats among themselves.

The prison guard says that if one of the prisoners can correctly guess the color of his hat then the prisoners will be set free and released. The puzzle for you is to figure out which prisoner would know the color of his own hat?And also discuss the various scenarios in which tell which prisoner will tell first the hat color he is wearing.

 Prisoners are not allowed to signal to each other, nor speak to each other to give each other hints. But, they can all hear each other if one of them tries to answer the question..

Solution :

Lets take the first Scenario

Z       |   A          B        C

White    White  Black  Black

In this case A can see both B and C's Hat and when he sees that both of them wearing Black hat he will know that he is wearing White Hat for sure,knowing that there are 2 Black and 2 White Hats.He than call the guard and tell him his Hat color and all the Prisoner will get released.

Now looking into second Scenario

Z       |  A          B           C

Black    Black   White    White

In this case again A will know that he must be wearing Black Hat as both  B and C are wearing White Hat.Again it is very Simple!!.

Now the problem will come for A when he will see two different color Hat next to him.Lets discuss third Scenario.

Z      |  A           B           C

Black  White   Black    White

Now A will see 1 Black Hat and 1 White hat next to him.So he will not be sure this time that what color hat he is wearing it may be White or may be Black.So he will not call guard.But do you think that prisoners will now never get released??..Actually its not true.What about B ? He can also call the guard isn't it?
So after waiting for sometime B will realize that A has not called the guard which means he is not sure of the color of his hat.Meaning he is seeing two different color Hat next to him.So B will check C's Hat color and see White color Hat.Now B is sure of wearing Black color hat and will call the guard.

In this riddle C and Z cannot call the guard as Z cannot see through wall and there is nobody on the right of C and he cannot see the color of Hat of B and A.So both Z and C can wait for A and B to guess the color of their hat correctly and all of them will get released.

Comments

  1. it is not clear that the 3rd case how A and Z release........

    ReplyDelete
  2. Actually in puzzle if any of the prisoner give correct answers...then all will be released and not only the prisoner who gave correct answer...so if B will give correct answer A and Z will also get released..

    ReplyDelete

Post a Comment

Popular posts from this blog

Tricky Questions or Puzzles in C

Program to uncompress a string ie a2b3c4 to aabbbcccc

Number series arrangement puzzles