This section we show the solution and comments of the hat puzzle [from winkler's paper]:
Colored Hats (simultaneous version):
It is not immediately obvious that any players can be saved. Often the first strategy considered is "guessing the majority color" ; e.g. if n=10, each player guesses the color he sees on 4 or more of his 9 teammates. But this results in 10 executions if the colors are distributed 5-and-5, and the most obvious modications to this scheme also result in total carnage in the worst case.
However, it is easy to save \lfloor n/2 \rfloor players by the following device. Have the players pair up (say husband and wife); each husband chooses the color of his wifes hat and each wife chooses the color she doesn't see on her husbands hat. Clearly, if a couple have the same color hats, the husband will survive; if different ,the wife will survive.
To see that this is best possible, imagine that the colors are assigned uniformly at random (e.g. by fair coin-flips), instead of by an adversary. Regardless of strategy the probability that any particular player survives is exactly 1/2; therefore the expected number of survivors is exactly n/2. It follows that the minimum number of survivors cannot exceed \lfloor n/2 \rfloor.
Colored Hats (sequential version):
This version of the hats game was passed to me by Girija Narlikar of Bell Labs, who heard it at a party (the previous version was my own response to Girija's problem, but has no doubt been considered many times before). For the sequential version it is easy to see that \lfloor n/2 \rfloor can be saved; for example, players n, n-2, n-4 etc. can each guess the color of the player immediately ahead, so that players n-1, n-3 etc. can echo the most recent guess and save themselves.
It seems like some probabilistic argument such as provided for the simultaneous version should also work here, to show that \lfloor n \rfloor is the most that can be saved. Not so : in fact, all the players except the last can be saved!
The last player (poor fellow) merely calls "red " if he sees an odd number of red hats infront of him, and "blue" otherwise. Player n-1 will now know the color of his own hat; for example, if he hears player n guess "red " and sees an even number of red hats ahead, he knowshis own hat is red.
Similar reasoning applies to each player going up the line. Player i sums the number of red hats he sees and red guesses he hears; if the number is odd he guesses "red", if even he guesses "blue", and he's right (unless someone screwed up).
Of course the last player can never be saved, so n-1 is best possible.