2 About the Prisoner's Dilemma
Evolutionary Prisoner's Dilemma
This program provides a simulation environment in which strategies for the Iterated Prisoner's Dilemma can be evolved and analysed.
Author:
Andrew Errity
[CACS4 99086921]
Faculty of Computing and Mathematical Sciences

A website accompanying this project may be found at http://www.computing.dcu.ie/~aerrity/undergrad.htm. This includes the runnable program, source code, API and other documentation.
In the Prisoner's Dilemma game two players are faced with a choice, they can either cooperate or defect. Each player is awarded points (called payoff) depending on the choice they made compared to the choice of the opponent. Each player’s decision must be made without knowledge of the other player’s next move. The player’s have no means of communication other than the game choices and there can be no prior agreement between the players concerning the game.
If both players cooperate they both receive a reward, R. If both players defect they both receive a punishment, P. If one player defects and the other cooperates, the defector receives a reward, T the temptation to defect, whilst the player who cooperated is punished with the sucker’s payoff, S. These game rules (and their typical values) are presented in the payoff matrix below

The dilemma here is that the only choice for rational players is to defect.
The name Prisoner's Dilemma comes from the following description of the problem:
The story is that of
two prisoners placed in separate cells, with the aim of getting one prisoner to
implicate the other. Each prisoner is given the option to defect against the
other, by giving evidence against them. If both prisoners defect (give
evidence) then the judge, in no doubt over their guilt, will send them both to
prison for 3 years. If both prisoners cooperate (don’t give evidence), then the
judge, with less clear indication of guilt, will send them both to prison for
only 1 year. However if one prisoner defects and the other does not, the judge
will take this as a clear sign of guilt, allowing the defector (evidence giver)
to walk free whilst sentencing the other prisoner to 5 years.
In order to successfully run this program your system will require:
The recommended hardware specifications are:
These instructions assume Java version 1.4.1 or greater is installed on your system.
a. Ensure your system meets the system requirements
b. Obtain the file epd.jar. This is available for download at http://www.computing.dcu.ie/~aerrity/undergrad.htm
c. Save this file to a location on your computer, for example c:\
The epd.jar file is the only file necessary to run the Evolutionary Prisoner's Dilemma program. To run the program, open a command prompt and run the following command,
java –jar <file location>\epd.jar
For example under Windows this might be:
java –jar c:\epd.jar
Whereas under a Unix based OS it might be:
java –jar /home/userid/epd.jar
If jar files have been correctly associated with Java in your Operating System settings you may be able to run the program by simply double clicking the epd.jar file.
When the Evolutionary Prisoner's Dilemma program is first run you will be presented with the blank application screen.

Main Window
The menu bar at the top of this window remains in place in all program modes and always provides the following options:
This dialog is accessed by clicking Rules in the menu bar and selecting Rules Settings.
This dialog allows you to configure the program parameters. Any changes made to the rules settings will affect all program windows. Changes made to rules during a simulation will not take effect until the next simulation. Changes made to the rules from the Interactive window will take effect immediately.
The Rules settings dialog box for the Interactive and Tournament windows is shown below. The following parameters may be set using the spinners or text entry:

Rules Dialog
The Rules dialog displayed from the Spatial Society window is shown below:

Rules Dialog - Spatial
This is identical to the previous dialog except for:
This dialog is accessed by clicking Strategies in the menu bar and selecting Strategy Manager.
This dialog allows you to manage the currently saved strategies.

Strategy Manager Dialog
At start-up, several preset strategies are stored. These are:
You can select a saved strategy from the drop down-list on the left and perform one of the following actions:

[Warning: When the application is closed any strategies saved in the strategy manager will be lost.]
The following section describes the three separate game windows which may be viewed. These windows may be viewed one at a time using the menu bar Game Type option.
[Warning: Switching between a Tournament Simulation and Spatial Simulation will cause any active simulations to end]
The tournament window allows you to run evolution simulations on populations of Prisoners playing an Iterated Prisoner’s Dilemma tournament.
When you first open a tournament window the following will be displayed:

Tournament Initial Window
This window consists of the following components:

Tournament Window
This window provides the following controls (in addition to the Rules Settings):
The strategy dialog boxes which open to display the fit/weak strategies update dynamically with population changes.

These dialogs allow you to save a Prisoner’s strategy in the strategy manager. Clicking save in this dialog will open a dialog box [see below] which allows you to enter a name under which to save the strategy. The strategy that was visible when you clicked save will be the one added to the strategy manager.

Having entered a strategy name clicking save will add the strategy to the strategy manager for later use.
[Warning: The strategy will be saved in the next free position in the strategy manager; if no empty spaces exist the strategy will not be saved]
[Warning: When the application is closed any strategies saved in the strategy manager will be lost.]
The spatial society window allows you to run evolution simulations on populations of Prisoners playing an Iterated Prisoner’s Dilemma tournament on a spatial grid.
When you first open a spatial society window the following will be displayed:

Spatial Society Initial Window
This window consists of the following components:

Spatial Society Window
This window provides the following controls (in addition to the Rules Settings):
The strategy dialog boxes which open to display the fit/weak strategies update dynamically with population changes.

These dialogs allow you to save a Prisoner’s strategy in the strategy manager. Clicking save in this dialog will open a dialog box [see below] which allows you to enter a name under which to save the strategy. The strategy that was visible when you clicked save will be the one added to the strategy manager.

Having entered a strategy name clicking save will add the strategy to the strategy manager for later use.
[Warning: The strategy will be saved in the next free position in the strategy manager; if no empty spaces exist the strategy will not be saved]
[Warning: When the application is closed any strategies saved in the strategy manager will be lost.]
This window allows you to play games of the Prisoner's Dilemma against saved strategies and pit saved strategies against one another
When first opened this window will display the following:

Interactive Window
The sub-windows which make up this window are:

Human vs. Computer

Computer vs. Computer