This is an old well-known puzzle:
You are one of 20 prisoners on death row with the execution date
set for tomorrow. Your King is a ruthless man who likes to toy with
his people's miseries. He comes to your cell today and tells you:
"I'm gonna give you prisoners a chance to go free tomorrow. You will
all stand in a row (queue) before the executioner and we will put a
hat on your head, either a red or a black one. Of course you will not
be able to see the color of your own hat; you will only be able to see
the prisoners in front of you with their hats on; you will not be
allowed to look back or communicate together in any way.
No talking, touching and the likes.
The prisoner in the back will be able to see the 19 prisoners in front
of him. The one in front of him will be able to see 18, and so on.
Starting with the last person in the row, the one who can see everybody,
he will be asked a simple question: WHAT IS THE COLOR OF YOUR HAT?
He will be only allowed to answer "BLACK" or "RED". If he says anything
else you will ALL be executed immediately.
If he guesses the right color of the hat on his head he is set free,
otherwise he is put to death. And we move on to the one in front of
him and ask him the same question and so on...
During the evening, the prisoners were allowed to get together and
devise a plan to guarantee the freedom of as many of them as possible.
Can you find a way to guarantee the freedom of some prisoners? How many?
The published answer is half of them, or 10. This way:
> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 >
#1 (who sees #2 to #20) starts and says the color of #11
#2 is next: says color of #12
...and so on to #10 who says color of #20
So 11 to 20 will know their color and be freed: so guarantee is 10.
And #1 to #10 each have a 50% chance; wonder how they were "elected"!
Now my question:
Can you think of a way that 19 of the prisoners will be guaranteed freedom?
All rules as outlined by the mean King must be followed
I got both my feet firmly planted in mid-air !