by Serge Helfrich 
The spatial variant of the iterated prisoner's dilemma is a simple yet powerful model for the problem of cooperation versus conflict in groups. The applet below demonstrates the spread of 'altruism' and 'exploitation for personal gain' in an interacting population of individuals learning from each other by experience. Initially the population consists of cooperators and a certain amount of defectors (a fraction represented by p). The advantage of defection is determined by the the value of b in the 'payoff matrix' (see below) which is used to calculate the payoff after each round for each 'player' on the basis of its strategy. For the next round a player determines its new strategy by selecting the most favourable strategy from itself and its direct neighbours.
You can use the links below to learn more about this fascinating topic in 'game theory':


BTW I stole the idea for this applet from A.L. Lloyd (Sci. Amer., June 1995, 8083).
opponent  

cooperate  defect  
player  cooperate  1  0 
defect  b  0 
Legend
p: fraction (0..1) of defectors in the first round Applet FAQGet Java if the applet does not start:
