PDA

View Full Version : Prisoners and hats puzzle



AppleyNO
July 27th, 2012, 06:11 PM
According to the story, four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed.

The jailer puts three of the men sitting in a line. The fourth man is put in a separate room. He gives all four men party hats. The jailer explains that there are two red and two blue hats; that each prisoner is wearing one of the hats; and that each of the prisoners is only to see the hats in front of them but not on themselves or behind. The fourth man in the other room can't see or be seen by any other prisoner. No communication between the prisoners is allowed.

If any prisoner can figure out and say to the jailer what colour hat he has on his head all four prisoners go free. If any prisoner suggests an incorrect answer, all four prisoners are executed. The puzzle is to find how the prisoners can escape, regardless of how the jailer distributes the hats.

Brendan
July 27th, 2012, 06:18 PM
take the hat off

AppleyNO
July 27th, 2012, 06:18 PM
take the hat off

This guy....
Then the hat would not be on his head, silly.

Brendan
July 27th, 2012, 06:19 PM
This guy....
Then the hat would not be on his head, silly.

you never said they couldn't take their hats off.

Glip
July 27th, 2012, 06:19 PM
According to the story, four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed.

The jailer puts three of the men sitting in a line. The fourth man is put in a separate room. He gives all four men party hats. The jailer explains that there are two red and two blue hats; that each prisoner is wearing one of the hats; and that each of the prisoners is only to see the hats in front of them but not on themselves or behind. The fourth man behind the screen can't see or be seen by any other prisoner. No communication between the prisoners is allowed.

If any prisoner can figure out and say to the jailer what colour hat he has on his head all four prisoners go free. If any prisoner suggests an incorrect answer, all four prisoners are executed. The puzzle is to find how the prisoners can escape, regardless of how the jailer distributes the hats.

Ah. This one was easy.

If the first 2 prisoners have the same color hat, then the third prisoner would immediately know that his hat is the opposite color. If the first two prisoners don't have the same color hat, then the middle prisoner, after realizing that the third prisoner doesn't automatically know what color his hat is, would then know that his hat is the opposite color of the first prisoner.

AppleyNO
July 27th, 2012, 06:20 PM
Ah. This one was easy.

If the first 2 prisoners have the same color hat, then the third prisoner would know that his hat is opposite color immediately. If the first two prisoners don't have the same color hat, then the middle prisoner, after realizing that the third prisoner doesn't automatically know what color his hat is, would then know that his hat is the opposite color of the first prisoner.
This guy. Within five minutes!
ARGHGHGHGH
Good job.

Brendan
July 27th, 2012, 06:21 PM
Fuck you guys I would just take my hat off and kill the jailer.

Duzero
July 27th, 2012, 06:21 PM
Should be something like this:



Of the 3 men sitting in a row only the man at the back of the row can know for sure what color his hat has, and that is if the 2 in front of him has 2 red or 2 blue hats. If they have one of each color then he has to stay silent.
That however makes the guy in the middle of the row know the color of his hat because he knows he and the first guy don't have the same color.

So if the colors are like this: red blue blue or blue red red then guy #3 can say the color of his hat.
If #1 and #2 have different colored hats like this: blue red or red blue then #3 won't know the color of his hat and will stay silent. But that silence tells #2 that his hat is the opposite of #1's hat.

Ash
July 27th, 2012, 07:02 PM
Fuck you guys I would just take my hat off and kill the jailer.
same, if i was with the 3 prisoners, i would tell them to help me raep him and then free the fourth segregated prisoner.

Zedkiel
July 27th, 2012, 08:12 PM
I got this, here's the real answer.
Trick question, they're all colorblind. The only one that isn't is Jamal and he is in the other room.

AppleyNO
July 27th, 2012, 09:03 PM
Alright, smart people. What about this one?

TEN HAT VARAINT
In this variant there are 10 prisoners and 10 hats. Each prisoner is assigned a random hat, either red or blue, but the number of each color hat is not known to the prisoners. The prisoners will be lined up single file where each can see the hats in front of him but not behind. Starting with the prisoner in the back of the line and moving forward, they must each, in turn, say only one word which must be "red" or "blue". If the word matches their hat color they are released, if not, they are killed on the spot. A friendly guard warns them of this test one hour beforehand and tells them that they can formulate a plan where by following the stated rules, 9 of the 10 prisoners will definitely survive, and 1 has a 50/50 chance of survival. What is the plan to achieve the goal?

Glip
July 27th, 2012, 09:39 PM
Alright, smart people. What about this one?

TEN HAT VARAINT
In this variant there are 10 prisoners and 10 hats. Each prisoner is assigned a random hat, either red or blue, but the number of each color hat is not known to the prisoners. The prisoners will be lined up single file where each can see the hats in front of him but not behind. Starting with the prisoner in the back of the line and moving forward, they must each, in turn, say only one word which must be "red" or "blue". If the word matches their hat color they are released, if not, they are killed on the spot. A friendly guard warns them of this test one hour beforehand and tells them that they can formulate a plan where by following the stated rules, 9 of the 10 prisoners will definitely survive, and 1 has a 50/50 chance of survival. What is the plan to achieve the goal?

This took me less time to figure out than the original puzzle.


The first guy to go is mr. unlucky 50/50 chance of survival, because what he has to do is say the color of the hat of the person directly in front of him.
That person, then, knows what color his hat is, and can either immediately say the color of his hat to indicate to the person in front of him that he has the same color hat, or wait a predesignated amount of time, say 10 seconds, before answering with his color hat, to signal to the person directly in front of him his hat is the opposite color.
And so on and so forth down the train.

Note: This only works if each prisoner actually cares about the lives of the other prisoners, and doesn't just immediately say the color of his hat regardless to just get out of there and say "screw you" to the rest of the prisoners XD.

Wouldn't be surprised if the first prisoner, who has a 50% chance to be screwed regardless, "gamethrew" and said the wrong color for the guy in front of him.

AppleyNO
July 27th, 2012, 10:40 PM
This took me less time to figure out than the original puzzle.


The first guy to go is mr. unlucky 50/50 chance of survival, because what he has to do is say the color of the hat of the person directly in front of him.
That person, then, knows what color his hat is, and can either immediately say the color of his hat to indicate to the person in front of him that he has the same color hat, or wait a predesignated amount of time, say 10 seconds, before answering with his color hat, to signal to the person directly in front of him his hat is the opposite color.
And so on and so forth down the train.

Note: This only works if each prisoner actually cares about the lives of the other prisoners, and doesn't just immediately say the color of his hat regardless to just get out of there and say "screw you" to the rest of the prisoners XD.

Wouldn't be surprised if the first prisoner, who has a 50% chance to be screwed regardless, "gamethrew" and said the wrong color for the guy in front of him.


This is A solution. This IS NOT the solution that was given to me, however.

The prisoners can use a binary code where each blue hat = 0 and each red hat = 1. The prisoner in the back of the line adds up all the values and if the sum is even he says "blue" (blue being =0 and therefore even) and if the sum is odd he says "red". This prisoner has a 50/50 chance of having the hat color that he said, but each subsequent prisoner can calculate his own color by adding up the hats in front (and behind after hearing the answers [excluding the prisoner in the back]) and comparing it to the initial answer given by the prisoner in the back of the line. The total number of red hats has to be an even or odd number matching the initial even or odd answer given by the prisoner in back.
There is no right way to solve this.

Glip
July 27th, 2012, 10:42 PM
This is A solution. This IS NOT the solution that was given to me, however.

The prisoners can use a binary code where each blue hat = 0 and each red hat = 1. The prisoner in the back of the line adds up all the values and if the sum is even he says "blue" (blue being =0 and therefore even) and if the sum is odd he says "red". This prisoner has a 50/50 chance of having the hat color that he said, but each subsequent prisoner can calculate his own color by adding up the hats in front (and behind after hearing the answers [excluding the prisoner in the back]) and comparing it to the initial answer given by the prisoner in the back of the line. The total number of red hats has to be an even or odd number matching the initial even or odd answer given by the prisoner in back.
There is no right way to solve this.
I will do one more Variant.

I did specify that it was "my" solution, not "the" solution ^.^

AppleyNO
July 27th, 2012, 10:43 PM
/Thread