Depending on the others always to hear the hat color alternates each next asked.
Hats

what does "alternate" mean?
al·ter·nate (ôl′tər-nāt′, ăl′-)
v. al·ter·nat·ed, al·ter·nat·ing, al·ter·nates
v.intr.
1.
a. To occur in a successive manner: day alternating with night.
b. To act or proceed by turns: The students alternated at the computer.
2. To pass back and forth from one state, action, or place to another: alternated between happiness and depression.
3. Electricity To reverse direction at regular intervals in a circuit.
v.tr.
1. To do or execute by turns.

Well, everyone knew from the beginning that they have to be saying the next' colour, but not all knew in which order.

hehe, I like being mean sometimes so here it is: You are walking on a road and you can either turn right or left. One road leads to luck, the other-to misery. Two twin brothers are there, and and they know which road leads where. One always lies, the other one always says the truth. You have one question, what will you ask?
I met a person who told me this riddle: A psycho is catching people, putting them in a row, so that everyone sees the back belonging to the person before him. He puts black or white hats on their heads. He comes to them from behind and asks everyone, what is their hat's coulour. If they get it right- they live. If they get it wrong-they die.
They cannot communicate in any way, but: they hear each other's replies. How can more than half of them be saved?
I did not manage to solve this, and I probably won't see the person who gave me that riddle in my life again. Can you help?