ok one more
once upon a time there were 100 dwarves living in a cave. each of the dwarves was wearing a hat (cap or whatever), either a red one or a blue one. none of the dwarves could see the color of their own hat, and neither the color of the other dwarves' hats, as it was pitch dark in the cave.
one day, the dwarf king decided to visit the cave. however, they were unable to make light in the cave for the king, so they had to get out to see the king. but since he was the king, a bit of discipline was required. the dwarves had to get out of the cave one by one, without turning around or looking back, without speaking to each other (or any speaking or communicating at all) and without taking their hats off. they had to get out of the cave and stand in a line, seperated by colors. so the line they would form would have to be first the dwarves with the red hats, and then the dwarves with the blue hats, or the other way around, but not mixed up in any way.
of course each dwarf, coming out of the cave, would see the colors of the hats of the dwarves already standing there - but still not their own hat. once a dwarf had taken his place in the line, he wasn't allowed to leave his place any more. they could shift to the left or right a bit, but they couldn't swap places with other dwarves.
how would they succeed in doing that?