Shown above are 4 men buried up to their necks in the ground.
They can not move so can only look forward.
Between A and B is a brick wall which can not be seen through.
They know that between them are 4 hats, 2 are black and 2 are white, but they do not know which colour they are wearing.
In order to avoid being shot one of them must call out to the executioner the colour of their hat. If they get it wrong, everyone will be shot.