There are 40 monks living on a deserted island, at the foot of a mountain with a monastery at the top. Each monk has either blue or green eyes--there is at least one monk of each eye color, but none of them knows which color he has. They can see each other's eyes, but cannot in any way communicate to each other anyone's eye color (ie, everyone knows everyone ELSE's eye color, but not their own). They gather every day for supper, but otherwise spend their time alone in their individual secluded huts. One day, God appears and tells them all that green-eyed monks are welcome to hike up the mountain to the monastery; but ONLY green-eyed monks are allowed. He says that one morning, every green-eyed monk will wake up knowing that he is a green-eyed monk, and when that day comes, they will each ascend the mountain during sunrise, leaving just the blue-eyed monks to gather for supper later that day. This does indeed happen. How do the green-eyed monks accomplish this?
Solution: For a better wording of the puzzle, see the xkcd version and its solution. Thanks to John Timmer for showing me.