So, to guarantee 99 people go home, that means 99 people
must each say the color of his or her hat. Since the first person can receive no clues, there is absolutely no way the first person can be sure to say his or her own color. Therefore, it must be the remaining 99 people who answer correctly.
Now, the hats can be distributed in any order and in any amount. They could all have black hats, they could all have white hats. They could have some black and white hats either mixed up, or all black first followed by all white. Since everyone else must say the color of his or her hat, the only added information can come from the first prisoner. The first prisoner can only say 'black' or 'white', which amounts to 'true' or 'false'... Hold on a second, I think I just realized something...
Okay, so the first prisoner counts the number of white hats he sees. If it is an odd number, he answers 'black'. If it's an even number, he answers 'white'. The second prisoner then counts the number of white hats she sees. If she counts an odd number and the first person said 'black', then her hat must be black because the first person also saw an odd number of white hats. If she counts an odd number of white hats and the first person said 'white', then her hat must be white so that the first person would see an even number of white hats. Similarly, if she counts and even number of white hats and the first person answered 'black', then her hat must be white, and if she counts and even number of white hats and the first person answered 'white', then her hat must be black.
Each prisoner in line keeps count of how many 'white' responses (s)he hears after the first and compares that to the number of white hats he or she sees. Then each prisoner uses that information, with the information of whether or not the first prisoner saw an odd or even number of white hats, to determine the correct color of his/her hat.
Nice riddle!
