Regarding the riddle with PhysicsGirl, I was thinking of a different answer following their brainstorm.

First of all, let's assume that the 1

st prisoner getting away with it is always a matter of luck.

Their answer assumes that there's an even number of prisoners, so that there's an odd number of hats of one certain color in front of the 1

st prisoner.

If this was not the case, there is either and odd number of each color or an even number of each color in front of him, so that first approach fails.

In that situation, the 1

st can save the 2

nd one's life by saying his color.

On the other hand, the 2

nd may be forced to choose between his own life and that of the guy in front of him. Suppose this line:

- Code: Select all
`01 02 03 04 05 06 07 08 09 10 11 12 13`

G G P G G P P G P G P G G

#1 says G to save his mate's life

#2 can say G and save his life OR say P to indicate that there's an odd number of P's ahead of him.

So a different solutionwould be voice pitch.

The 1

st one will save the 2

nd one's life by telling him his color.

The 2

nd one will say his color in a normal voice if the hat ahead is the same color as his or in a high pitch if it isn't.

This way, if the first one's lucky, you 100% success. If he's not... well, it's just one.

Regarding the riddle with PhysicsGirl, I was thinking of a different answer following their brainstorm.

First of all, let's assume that the 1[sup]st[/sup] prisoner getting away with it is always a matter of luck.

Their answer assumes that there's an even number of prisoners, so that there's an odd number of hats of one certain color in front of the 1[sup]st[/sup] prisoner.

If this was not the case, there is either and odd number of each color or an even number of each color in front of him, so that first approach fails.

In that situation, the 1[sup]st[/sup] can save the 2[sup]nd[/sup] one's life by saying his color.

On the other hand, the 2[sup]nd[/sup] may be forced to choose between his own life and that of the guy in front of him. Suppose this line:

[code]01 02 03 04 05 06 07 08 09 10 11 12 13

G G P G G P P G P G P G G[/code]

#1 says G to save his mate's life

#2 can say G and save his life OR say P to indicate that there's an odd number of P's ahead of him.

So a different solutionwould be voice pitch.

The 1[sup]st[/sup] one will save the 2[sup]nd[/sup] one's life by telling him his color.

The 2[sup]nd[/sup] one will say his color in a normal voice if the hat ahead is the same color as his or in a high pitch if it isn't.

This way, if the first one's lucky, you 100% success. If he's not... well, it's just one.