Originally posted by: merlocka
Originally posted by: TuxDave
Originally posted by: merlocka
Originally posted by: TuxDave
Originally posted by: merlocka
The last guy has a 50-50 to live.
But he counts the remaining hats. If it's even, he says red. If it's odd, he says black.
The second guy counts the hats. He knows what color he has. He then repeats the above.
98% survival rate.
This was in CS101, it's a parity check.
That makes no sense.
B <--- front of line
R
B
R
B
R <--- back of line
So let's say he's counting the number of black hats remaining and if it's odd he says black and if it's even he say red.
So guy #6 says Black (cuz he sees 3 black hats) and dies.
Guy #5 knows that he has a black hat but to follow the rules, he has to say red because he needs to pass on the information that there are an even number of blacks remaining. He dies too.
Guy #4 gets stuck in the same boat, dies too
....etc...
and soon everyone is dead.
Boy. U better hope your king doesn't lose any wars...
.... waiting for a rewritten answer.
Jeez... would you like coffee and desert too?
BRRBRBBBR
1234567890
Black is the pre-decided upon "parity bit"
Guy0 looks ahead of him. There are 5 black hats. So he says black.
Guy9 hears him. He also knows if he's been shot or not. He looks ahead. He sees 4 black hats. He now knows how many black hats in front, and behind, and whether the total number of black hats is even or odd.
In this case, Guy0 was shot... poor bastage.
Guy9 counts 4 black in front of him. Since Guy0 said black (odd). He knows he must have on a black hat. So he says black.
Guy 8 heard it all too. Guy0's answer, whether guy0 was shot, and guy9's answer. He now knows how many black hats behind him (2), and how many in front (3), and that from Guy9 on the total was odd.
Lather rinse repeat.