The Prisoner's Dilemma: Explanations
 

Introduction

The Prisoner's Dilemma stems from the following situation: two people have been arrested for a crime and are interrogated separately by the police. Each is given the incentive to talk about his accomplice's role in exchange for a reduced sentence. Each has then the choice to stay true to his partner or to defect.

The program presented here extends this situation by setting up a two-dimensional array of "prisoners". Every round, each prisoner deals with its nearest neighbors (8 in the case of a square pattern - except on egdes and corners). When both parties are honest, they each gain 1 point. When both are dishonest, their gain is zero. Now when one cheats and the other not, the cheated gains nothing, but the traitor gains a certain amount. This amount can be varied.

After the round of dealing, each prisoner looks at the gains and behaviors of its neighbors. If the prisoners with the opposite behavior have gained more, the prisoner switches its behavior. Obviously when the amount gained by cheating an honest cell is above 1, defectors will tend to spread, whereas the opposite happens when the gain is smaller than 1. However one population is seldom wiped out completely. Small islands of one behavior tend to survive among a see of opponents.

A full description of this puzzle and a more general reference to mathematics applied to social interaction can be found in Scientific American:

  • Martin A. Nowak, Robert M. May and Karl Sigmund, The Arithmetic of Mutual Help, Scientific American, June 1995, Vol. 272, No. 6, pp. 50-55.
  • Alun L. Lloyds, The Amateur Scientisct: Computing Bouts of the Prisoner's Dilemma, Scientific American, June 1995, Vol. 272, No. 6, pp. 80-83.

Running the game

Pressing the "Start" button will get the game running until the "Stop" button is pressed. Pressing the "Step" button computes just one game turn. When the game is running freely, the display is not refreshed at the end of every game turn, but every 100 turns (by default). This is the "Refresh Frequency".

Other indications appear in the box at the bottom of the window:

  • "Iteration" is the number of the game turn;
  • "Columns" and "Rows" indicate the number of columns and rows making up the game board;
  • "Incentive" is the variable gain factor when a prisoner cheats an honest one;
  • A prisoner switches behavior when the other behavior gains more. A minmimum level of extra gain can be required before switching. This is the "Threshold";
  • Two colored squares indicate the color code for honest and dishonest behaviors.

All these parameters can be changed by clicking on the "Options..." button. A window pops up with fields for editing any or all of these values.

The Prisoner's Dilemma option dialog

Pressing "Cancel" returns to the current game. Pressing "OK" stops the current game (if any) and initiates a new game with the new values, except if the only parameter that changed is the refresh frequency. Setting large values for the width and height makes it very long to generate the board. 100 x 100 is already pretty time-consuming.

The initial behavior of each prisoner is determined randomly, with a fifty-fifty chance for each behavior. When the "Restart" button is pressed, a new game is generated with the same parameters, but with a new random behavior distribution.

Technical information

If you are intesrested in the programming itself, a more technical description is available as well as the javadoc.