Copyright seal
eagle - symbol for defection   Welcome to Iterated Prisoner's Dilemma Online Game and Simulation dove - symbol for cooperation

This is an interactive game inspired by the Iterated Prisoner's Dilemma game theory as described in the book The Selfish Gene by Richard Dawkins (1989 p. 205). This game theory is useful to demonstrate the evolution of co-operative behaviour. Coded in Javascript by Wayne Davis.

Your browser may have problems running this online game. A Javascript 1.1 enabled browser such as Netscape 3.0 or better is required.

Scenario: you and your colleague, Lucifer, are in jail and suspected of committing a crime. You are isolated from each other and do not know how the other will respond to questioning. The police invite both of you to implicate the other in the crime (defect). What happens depends on what both of you do, but neither of you know how the other will respond. If Lucifer betrays you (yields to the temptation to defect) while you remain silent, then you receive the longest jail term while Lucifer gets off free (and visa versa). If you both choose to cooperate with each other (not the police) by remaining silent, there is insufficient evidence to convict both of you, so you are both given a light sentence for a lesser crime. If both of you decide to defect, then you have condemned each other to slightly reduced but still heavy sentences.

The payoff in this game is a reduction in prison sentencing of very good, fairly good, fairly bad or very bad, which is translated into a point score system as follows:

This table shows payoffs to you for various outcomes. What Lucifer Does
You Do
Co-operate Fairly good.
for mutual co-operation.
3 points
Very bad.

0 points
Defect Very good.
to defect.
5 points
Fairly bad.
for mutual defection.
1 point

The game is played iteratively for a number of rounds until it is ended (as if you are repeatedly interrogated for separate crimes). The scores from each round are accumulated, so the object is to optimise the point score before reaching game over. Game over is determined randomly anywhere between 1 and 100 rounds. At the end of the game, the scores are translated into percentages of the best possible scores. The Mutual Outcome rating represents the combined scores achieved by both players compared to the best possible combined score. Start the game by clicking either the co-operate or defect button below and then base your next choice on the outcome.

Your ActionLucifer's Action
your action my action
Your Score:             Lucifer's Score:



              Strategy Definitions

Random Intervention (%):             1   2   5   10   20   30   40  

Simulation Rate (secs / round):   0.05   0.2   0.5   1   2   5   10   30    

Number of Simulation Rounds:     50   100   200   500   1,000   10,000      

Customised Strategy 1:   T= P= R= S= B=
Customised Strategy 2:   T= P= R= S= B=

Average Outcome Ratings (%)
Your Outcomes Lucifer's Outcomes
Mutual Outcomes
Lucifer's Average Strategy Ratings (%)
Tit For Tat Tit For Tat / Random
Tit For Two Tats / Random Tit For Two Tats
Naive Prober Remorseful Prober
Naive Peace Maker True Peace Maker
Random Always Defect
Always Co-operate Grudger
Pavlov Pavlov / Random
Adaptive Gradual
Suspicious Tit For Tat Soft Grudger
Customised 1 Customised 2


Related Sites

Spatialised Prisoner's Dilemma: Evolution Simulator

Iterated Prisoner's Dilemma related resources

Reference: Richard Dawkins (1989). The Selfish Gene. Second edition. Oxford University Press.

Example of how to cite this website: Davis, W 1997, Iterated Prisoner's Dilemma Online Game and Simulation, accessed 26 March 2017, <>

Copyright 1997 - 2017, Wayne Davis