This is my favourite challenge problem, simply because it only requires pure logic, nothing else.
Look at this diagram: http://img179.imageshack.us/img179/769/4soldiers.png
There are four prisoners, buried to their necks in the ground. Each of them is wearing a hat. They know that there are four of them. They know that each prisoner is wearing just one hat. The prisoners know that there are two black hats and two white hats. They cannot turn their heads even the slightest, they can only look straight ahead.
The arrows on the diagram indicate the direction of their heads.
Prisoner 1 can only see the brick wall.
Prisoner 2 can only see the brick wall.
Prisoner 3 can see Prisoner 2 and the brick wall.
Prisoner 4 can see Prisoner 3, Prisoner 2 and the brick wall.
From Prisoner 1 to Prisoner 4 (i.e. left to right), the hats have been arranged white-black-white-black. The prisoners do NOT know this.
The prisoners do not know what colour hat is on their head.
The guard has told the prisoner that each of them can only speak one word: either 'black' or 'white'. If what the prisoner says is the correct colour of the hat on his head, then all of them are freed. If what the prisoner says is incorrect, all four of them are killed instantly.
Only one prisoner out of the four can work out what out what colour hat is on his head.
Who is it and why?
(The answer is NOT that one of them takes a lucky guess).

