The Prisoner's Dilemma
This page is obsolete (and only here for historical reasons). You may want to check out the Java application or the Android app.
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':
demonstration applet
BTW I stole the idea for this applet from A.L. Lloyd (Sci. Amer., June 1995, 8083).
the payoff matrix
 opponent 
 cooperate  defect 
player  cooperate  1  0 
defect  b  0 

Legend
 is cooperating, did cooperate
 is defecting, did defect
 is cooperating, did defect
 is defecting, did cooperate
b: advantage for defection when opponent cooperates
p: fraction (0..1) of defectors in the first round
Applet source code
Get Java if the applet does not start:

suggested experiments
 Try different b values between 1.00 and 3.00. Find out how the behavior changes. When do
defectors tend to be isolated and when do they form interconnected structures around moving
colonies of cooperators?
 To see the gradual defector invasion pattern choose a low value for p (like 0.001)
and a b value about 1.85... and if you're lucky
enough to start with just one defector you'll get the kaleidoscope.
 Chen figures. Rowland Chen discovered that if you use b = 1.9 and p = 0.6 a "walking man" will appear in about 1 out of 20 runs. Also a "crawling bug" can emerge. A stable figure that looks like a rotating F appears more often. Rory Plaire noted that some interesting patterns emerge when b = 1.800000015 and p = 0.5, e.g. the "crawling bug" (or "walking man" seen from above) making the kaleidoscope explode. The FAQ may be helpful in explaining these phenomena.
 [...]