Posted 26 September 2011 - 08:38 PM
Some of you guys seem to be missing the point. You cannot guarantee to be saved if you say the color of the person in front of you. In the worst case scenario, every other person is wearing a different color (black, red, black, red, ...). If each person says the color of the person in front of him, then everyone is dead. Although, using this method you can guarantee that 50% will survive (the prisoners standing in the even positions) and the ones in the odd positions have a 50/50 chance, so that's 75%. But the real answer guarantees all will survive except the first one who has a 50% chance. Here how it works:
Before hands the prisoners need to agree that the person at the end of the line counts the red hats in front of him and if even he calls red, and if odd, he calls black. From that point on, everyone needs to keep track of two things:The number of red hats in front, and how many people (aside from the first person) have called red. Then follow this basic logic
If the first person called red and these two numbers are both even or both odd, then call black, otherwise red
If the first person called black and these two numbers are both even or both odd, then call red, otherwise black
Let's go over a simple example to clear this out. Let's say there are 10 prisoners instead of 20 and this is the hat order:
r, b, r, r, b, r, b, b, b, r
The first person sees 4 red hats and calls red (luckily he survives)
Based on the logic above (first line)
The second person sees 4 red hats and 0 other prisoner has called red. Both numbers are even so he calls black
The third person sees 3 red hats and 0 other prisoner has called red. One number is odd and one even, so he calls red
The fourth person sees 2 red hats and 1 other prisoner has called red. One number is odd and one even, so he calls red
The 5th person sees 2 red hats and 2 other prisoners have called red. Both numbers are even so he calls black
The 6th person sees 1 red hat and 2 other prisoners have called red. One number is odd and one even, so he calls red
The 7th person sees 1 red hat and 3 other prisoners have called red. Both numbers are odd so he calls black
The 8th person sees 1 red hat and 3 other prisoners have called red. Both numbers are odd so he calls black
The 9th person sees 1 red hat and 3 other prisoners have called red. Both numbers are odd so he calls black
The 10th person sees 0 red hats and 3 other prisoners have called red. One number is odd and one even, so he calls red
In this case everyone was saved, but the first one was lucky. I'll do another example with odd number of red hats in fron of the first person
r, r, r, b, b, r, b, r, r, b
The first person sees 5 red hats and calls black (dead)
Based on the logic above (second line)
The second person sees 4 red hats and 0 other prisoner has called red. Both numbers are even so he calls red
The third person sees 3 red hats and 1 other prisoner has called red. Both numbers are odd so he calls red
The fourth person sees 3 red hats and 2 other prisoners have called red. One number is odd and one even, so he calls black
The 5th person sees 3 red hats and 2 other prisoners have called red. One number is odd and one even, so he calls black
The 6th person sees 2 red hats and 2 other prisoners have called red. Both numbers are even so he calls red
The 7th person sees 2 red hats and 3 other prisoners have called red. One number is odd and one even, so he calls black
The 8th person sees 1 red hat and 3 other prisoner has called red. Both numbers are odd so he calls red
The 9th person sees 0 red hats and 4 other prisoner has called red. Both numbers are even so he calls red
The 10th person sees 0 red hats and 5 other prisoner has called red. One number is odd and one even, so he calls black
I hope the was clear enough