Demons and Dwarfs

An evil demon captures a large, unspecified number of dwarfs. At each dwarf’s entry interview, the demon plants a red or green gem in the dwarf’s forehead. The demon informs the new recruit:

* that he, the dwarf, has an unremovable red or green jewel in his forehead
* that he, the demon, is not going to tell him which color, nor will anyone else (the dwarfs are strictly forbidden to communicate)
* that one of the colors denotes sniveling company spies and the other color denotes those particularly lucklyess captives who are not even snivelying company spies
* that the demon does not choose to tell him which color denotes which, nor will he tell him ever.

End of entry interview.

Every day the dwarfs line up in formation so that the demon can count them, just to make sure no one has escaped.

One day the demon gets tired of the dwarfs and decides to get rid of them. He announces that he will set the dwarfs free, provided they all deduce the color of their gems. As a hint, he tells them that there is at least one dwarf with a red gem, and at least one with a green gem. To earn their collective freedom, the dwarfs must signal wordlessly at the daily lineup. All the dwarfs with red gems are to step one pace forward, while the dwarfs with green gems remain behind. If they are correct, then all the dwarfs are free to go back to their homes in the coal mines. If they are not correct, all the dwarfs will be slaughtered on the spot.

The dwarfs are free to take as long as they want to determine the colors of their gems. They are all perfectly logical, and are all dying to get back to their homes. What should they do?

Dewdles by Sam