A Warden shows 100 prisoners six hats, each of a different color: red, yellow, blue, green, white, and black. He explains that the 100 prisoners will soon be blindfolded and fitted with 100 hats of these colors, in any order or ratio that the Warden chooses.
Once they have their hats, their blindfolds will be removed. One by one, each prisoner will be allowed to walk around and look at the other prisoners’ hats, taking notes on a note pad if he wishes. After everyone has had a chance, they will all be asked to sit down and simultaneously write down a guess for their own hat color. If all 100 prisoners guess correctly, or if all 100 prisoners guess incorrectly, then they will all be set free. However, if some are right and some are wrong, everyone will return to solitary.
What strategy will ensure that they will all be set free? (Of course, other than discussing a strategy before the game begins, the prisoners cannot communicate with each other in any way, or they will be shot.) (Also, assume that the prisoners are all competent to execute whatever strategy they agree upon...perhaps they are white collar criminals)