I've just finished reading The Selfish Gene (Dawkins) twice and I wanted to try to make for myself the computer simulations he talks about in one of the final chapters. I remember Sagan mentioning them in The Demon Haunted World too. The game is about about strategies for survival in a social environment and the evolution of what we perceive as morals.
The game is a version of "iterated prisoner's dilemma" (but I opted to call it ORGs for brevity) and it involves organisms with different survival strategies playing against each other for domination (or co-domination) of their world. The strategies consist of "how do I act when I meet another particular organism?". In an encounter, your org can can either play nice (true) or play mean (false), according to its strategy. To inform its actions, all it has is a memory of what the particular opponent did last time they met*.
The reward or penalty from a single interaction depends on how the other organism plays, thus your organism must predict, based on its memory, what the other will do. They can cooperate (both play true) for a moderate reward, mutually defect (false, false) for a tiny penalty, or take advantage (F,T)/be taken advantage of (T,F) for a large reward and large penalty, respectively.
The currency you are being rewarded or penalized in is "life". If you lose too much life, you're dead. If you gain enough life, you may spawn asexually and your children are added to the world where you have to make your living.
An example of a strategy could be "if my opponent played false last time, play false back to him. If he played true, be true. If I haven't met him before, be charitable and play true". This is how the org called "Superman" in the above simulation plays the game. Another strategy could be "play true and false randomly, regardless of what my opponent did last time". This is what Rando does, and I keep him in the game as a control. "Douche" plays false no matter what and does quite well against random or naive players (you can guess how "NiceGuy" plays). Whether the Douches of the world dominate in the game depend on the strategies of your fellow orgs.
*actually, in v.1.05, I have given the orgs new memory systems and more sensory powers to make the game more interesting. Now your org can know...
- its own last play (whether it played true or false on the last encounter)
- up to the last 5 plays against it (whether it was played true or false against in the last five encounters, regardless of which org it played. I refer to this as an "emotional memory" because it gives your org a feeling of how the world is treating it, whether it's in a world of mostly douches or niceguys)
- up to three past plays against it from each particular org (previously it only kept track of the last play ((one)) per org. So now your org can choose to hold a grudge longer against a particular individual or it can choose to forgive 1 or 2 indiscretions)
- an estimate of its own life (within 10%. So now it can change its behaviour if your org thinks it's about to die)