Prisoners in Hats 2
Ages ago I wrote an article in a series of puzzle about prisoners with hats. Here is another one involving a light bulb. These are a bit of an archetype in the world of puzzles, but while they may appear similar to each other, there is usually some different structure of logic under the bonnet.
In this version there are three prisoners (X, Y and Z) sitting around a table. Each is wearing either a black or a white hat with each being equally likely. They are not allowed to communicate to each other in any way, but each must write down a guess as to what colour hat they themselves are wearing. They can guess Black, White or Pass. After all three have written down their guesses (secretly) the warden will look at them. If anyone guessed incorrectly, or all three people passed then they will be killed, but if at least one person guessed correctly (with no one getting it wrong) then everyone goes free. If they are allowed to discuss tactics beforehand, what strategy should the prisoners adopt in order to maximise their chances of survival?
At first it seems unlikely that any strategy will get a probability of more than a half of going free. After all, each prisoners independently has a half chance of getting it right if the others just pass and having more than one person guessing just compounds the potential errors.
However, there is a clever trick; by choosing who is the guesser dynamically we can improve the chances to 75%. The strategy is: if you can see two hats of the same colour then guess the opposite colour, else pass.
Let's have a look at in action. The're are 8 different combinations of Black and White hats, we can see who would guess what in each case and whether they were correct:
|State of Hats
The only cases that the strategy loses are when everyone has the same colour hat, which only happens 2 out of the 8 times. Notice that there are a total of 12 guesses across the grid of which half are correct and half are not, meaning that it doesn't violate our observation that everyone has a half chance of getting their own hat colour correct. However this method bunches up all of the incorrect guesses into 2 big groups, while our winners spread across the other 6. We have gerrymandered our probabilities.
This turns out to be the optimal solution. Right, four people are sitting around a table wearing hats. Off you go.