WoodCentral Forums

Est. 1998 — 27 years of woodworking knowledge

Friday puzzle -- red and blue cap reprise

Posts

Friday puzzle -- red and blue cap reprise

#1

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?

Re: Friday puzzle -- red and blue cap reprise

#2

just off the top of my head

expected 75, guaranteed 50

Re: Friday puzzle -- red and blue cap reprise

#3

That's an improvement

but they can do still better.

P.s., I presume you got to that by having each even-numbered wise man tell the one in front of him what color his cap was? If you came to this answer by another route, that would be interesting.

Re: Friday puzzle -- red and blue cap reprise

#4

Re: That's an improvement

I think I see a way to get 66% guaranteed, 83 expected.

Re: Friday puzzle -- red and blue cap reprise

#5

getting closer

Go ahead and state your method for achieving those results.

Re: Friday puzzle -- red and blue cap reprise

#6

Re: getting closer

The first wise man looks at the two immediately in front of him. If they both have the same color hat he says "blue". If they have different color hats he says "red". Of course he has only a 50% chance of being correct about his own hat.

The second wise man remembers this and looks at the one immediately in front of him. If the first man said "blue", then he knows his hat is the same color as the one in front of him and says whatever color that is. Otherwise, he knows and says the opposite.

The third wise man remembers what the first two said. He knows what color the hat behind him is and knows if it is the same or different than his. So he can also speak his color with confidence.

The process repeats with each group of three until there is one left who tosses a coin.

Re: Friday puzzle -- red and blue cap reprise

#7

On the right track

Re: Friday puzzle -- red and blue cap reprise

#8

Got it.

Unless you know of a way to get better than 99.5.

Re: Friday puzzle -- red and blue cap reprise

#9

Excellent!

Let's leave it open for a while in case anyone else wants to try.

Re: Friday puzzle -- red and blue cap reprise

#10

Hint -- the goal

As Bill said in his post titled "got it", it is possible to get expected survival of 99.5. It is not possible to give the wise man at the back of the line any better chance than 50-50, since he has no opportunity for knowledge to improve his guess. But it is possible to assure survival of the other 99!

Re: Friday puzzle -- red and blue cap reprise

#11

I think I have it also

Re: Friday puzzle -- red and blue cap reprise

#12

hmmm... or maybe not ;-(

Re: Friday puzzle -- red and blue cap reprise

#13

Re: Hint -- the goal

I think even I got it, thanks to Bill and the hints from Alex.

Re: Friday puzzle -- red and blue cap reprise

#14

or maybe so ;-).....

But not the way I thought of originally. (and maybe never without some of the hints.)

Re: Friday puzzle -- red and blue cap reprise

#15

Bill, do the honors?

You got it with the least hinting (I didn't get it at all).

After you give your explanation, I'll show the "solution" given where I saw this one, which I found almost as difficult as the puzzle!

Re: Friday puzzle -- red and blue cap reprise

#16

My solution

The first wise man can see the other 99 caps. Among these caps there must be either an odd number of red caps or an odd number of blue caps. He will say the color with the odd count. For this example we will assume it is blue.

The second wise man will count the number of blue caps that he can see. If it is odd, then his cap must be red. If it is even, his cap must be blue. So he can say the right thing.

Each subsequent wise man will count the number of blue caps in front of him plus the number of blue caps reported behind him (excluding the report from the first wise man). If the total is even, his hat is blue. Otherwise it is red.

Re: Friday puzzle -- red and blue cap reprise

#17

That is a clear explanation

Just for comparison, here is the "solution" I saw, which left me pretty befuddled. It is correct, but sounds more like directions for someone to code the solution in a programming language than an explanation:

The first wise man counts all the red hats he can see (Q) and then answers "blue" if the number is odd or "red" if the number is even. Each subsequent wise man keeps track of the number of red hats known to have been saved from behind (X), and counts the number of red hats in front (Y).

If Q was even, and if X&Y are either both even or are both odd, then the wise man would answer blue. Otherwise the wise man would answer red.

If Q was odd, and if X&Y are either both even or are both odd, then the wise man would answer red. Otherwise the wise man would answer blue.

Re: Friday puzzle -- red and blue cap reprise

#18

Re: That is a clear explanation

Just check to see if the parity bit is set or not ;-)

👍 This page answered my questions

Your vote helps other woodworkers quickly find the answers and techniques that actually work in the shop.