Friday puzzle -- red and blue cap reprise
Dan challenged us a few months ago to line up wearers of red and blue caps in a certain way. This is another puzzle about wearers of red and blue caps who can't see the colors of their own caps. I think it is very difficult (but not once it is explained). Of course, we have seen that one person's difficult is another person's easy, depending on how the puzzle strikes you.
A stark raving mad king tells his 100 wisest men he is about to line them up and that he will place either a red or blue hat on each of their heads. Once lined up, they must not communicate amongst themselves. Nor may they attempt to look behind them or remove their own hat.
The king tells the wise men that they will be able to see all the hats in front of them. They will not be able to see the color of their own hat or the hats behind them, although they will be able to hear the answers from all those behind them.
The king will then start with the wise man in the back and ask "what color is your hat?" The wise man will only be allowed to answer "red" or "blue," nothing more. If the answer is incorrect then the wise man will be silently killed. If the answer is correct then the wise man may live but must remain absolutely silent.
The king will then move on to the next wise man and repeat the question.
The king makes it clear that if anyone breaks the rules then all the wise men will die, then allows the wise men to consult before lining them up. The king listens in while the wise men consult each other to make sure they don't devise a plan to cheat. To communicate anything more than their guess of red or blue by coughing or shuffling would be breaking the rules.
You may assume that every wise man is willing to cooperate to increase the chances for others, as long as it is not to the detriment of his own chances of survival.
What strategy or strategies can they adopt to maximize the number of wise men expected to survive and the number guaranteed to survive, and what are those best results?
Example 1: Everyone flips a coin and says "blue" if heads, or "red" if tails. 50 wise men expected to survive, none guaranteed to survive.
Example 2: Like above, but the 2nd from the front agrees to guess the color of the hat on the person in front of him (which he will do to help that person, since it won't affect his odds). Expected survival 50.5; guaranteed survival 1.
What's the best strategy you can come up with?