since all prisoners are allowed to talk to each other and to set a strategy, mine would be this: the first one to be executed is to say the color of hat in front of him, so that the second shall know what to say. if there is n person, we have 1/2 chance to save all prisoners and another 1/2 to save n-1.
You are correct. But they have to agree before they line up that starting from the back of the line, the even numbered guys agree to say what the odd number guys said, while the odd number guys will just say what the even number guys hat colors are. As soon as they line up they have to make mental note whether they are odd or even.
The odd number guys are screwed. If they wear alternating colored hat, with certainty you save 1/2 of all prisoners and n=even, 1/2*(n-1) if n=odd.
And they are only allowed to say one thing after they line up, either "white" or "black".
Example just use 10 guys to break down the problem.
Because the last guy calls out 2nd guys hat color, he has 1/2 chance.
2nd guy calls out what last guy said. He is saved for sure.
3rd guy calls out calls out 4th guys hat color, he has 1/2 chance.
4th guy calls out what 3rd guy said. He is saved for sure
5th guy calls out calls out 6th guys hat color, he has 1/2 chance.
6th guy calls out what 5th guy said. He is saved for sure.
7th guy calls out 8th guys hat color. He has 1/2 chance.
8th guy calls out what 7th guy said. He is saved for sure.
9th guy calls out 10th guys hat color. He has 1/2 chance
10th guys calls out what 9th guy said. He is saved for sure.