Evolving Strategies for the Prisoner's Dilemma
A B C D E F G H I M P R S T U V

A

actionPerformed(ActionEvent) - Method in class ie.errity.pd.graphics.TournamentPanel
ActionListener listens for events
actionPerformed(ActionEvent) - Method in class ie.errity.pd.graphics.SpatialPanel
ActionListener listens for events
actionPerformed(ActionEvent) - Method in class ie.errity.pd.graphics.PrisonerDialog
An ActionListener listening for button presses
actionPerformed(ActionEvent) - Method in class ie.errity.pd.graphics.MenuFrame
ActionListener listens for menubar actions
actionPerformed(ActionEvent) - Method in class ie.errity.pd.graphics.InteractivePanel
ActionListener for any button events
addData(int, int, double) - Method in class ie.errity.pd.graphics.GraphPanel
Add values to the graph

B

Breed(Prisoner[]) - Method in class ie.errity.pd.genetic.Breeder
Breeds the next generation (panmictic mating) of an array of Prisoners
Breeder - class ie.errity.pd.genetic.Breeder.
Provides a means of evolving a population of Prisoners via a genetic algorithm
Breeder() - Constructor for class ie.errity.pd.genetic.Breeder
Create a new Genetic Breeder
Breeder(Rules) - Constructor for class ie.errity.pd.genetic.Breeder
Create a new Genetic Breeder using Rules given

C

clear() - Method in class ie.errity.pd.graphics.GraphPanel
Reset the graph
clear() - Method in class ie.errity.pd.genetic.Spatial
Reset the grid
clear() - Method in class ie.errity.pd.genetic.Breeder
Reset the breeder
clone() - Method in class ie.errity.pd.Prisoner
Copy the current Prisoner
construct() - Method in class ie.errity.pd.graphics.SwingWorker
Compute the value to be returned by the get method.
crossover(BitSet, BitSet) - Static method in class ie.errity.pd.genetic.Genetic
Mate two parents using random, one point crossover

D

delete(int) - Method in class ie.errity.pd.graphics.PrisonerDialog
Removes an element from the listbox
delete(int) - Method in class ie.errity.pd.graphics.MenuFrame
Removes a saved strategy
delete(int) - Method in class ie.errity.pd.graphics.InteractivePanel
Removes an element from the listbox

E

EmeraldTheme - class ie.errity.pd.graphics.EmeraldTheme.
This class implements a custom 'green' look and feel to replace the default Java metal look and feel.
EmeraldTheme() - Constructor for class ie.errity.pd.graphics.EmeraldTheme
 
epd - class ie.errity.pd.epd.
MAIN class.
epd() - Constructor for class ie.errity.pd.epd
 
Evolve() - Method in class ie.errity.pd.genetic.Spatial
Evolve a new generation using an Evolutionary algorithm

F

finished() - Method in class ie.errity.pd.graphics.SwingWorker
Called on the event dispatching thread (not on the worker thread) after the construct method has returned.
freeSpace() - Method in class ie.errity.pd.graphics.MenuFrame
Check if there is a free space in the Prisoners list

G

Game - class ie.errity.pd.Game.
A game of the Iterated Prisoner's Dilemma between two Prisoners
Game(Prisoner, Prisoner, Rules) - Constructor for class ie.errity.pd.Game
Create a new game of the Iterated Prisoner's Dilemma between two players
Genetic - class ie.errity.pd.genetic.Genetic.
Provides Genetic operations
Genetic() - Constructor for class ie.errity.pd.genetic.Genetic
 
get() - Method in class ie.errity.pd.graphics.SwingWorker
Return the value created by the construct method.
get(BitSet) - Method in class ie.errity.pd.Moves
Decodes a 3 game history to an index number
getColor() - Method in class ie.errity.pd.Prisoner
Return which color to render the prisoner (based on it's strategy)
In order to differentiate between different 'types' of player this method sets color according to how often the Prisoner will cooperate and how often they defect Orange/Red signifies defecting ('nasty') strategies Yellow/Green signifies cooperating ('nice') strategies Blue indicates balanced strategies
getCrossP() - Method in class ie.errity.pd.Rules
 
getGen() - Method in class ie.errity.pd.graphics.RulesDialog
Get number of generations
getGenerations() - Method in class ie.errity.pd.Rules
 
getIterations() - Method in class ie.errity.pd.Rules
 
getMutateP() - Method in class ie.errity.pd.Rules
 
getName() - Method in class ie.errity.pd.Prisoner
Returns the Prisoner's name
getName() - Method in class ie.errity.pd.graphics.EmeraldTheme
Returns the name of the theme.
getNumP() - Method in class ie.errity.pd.graphics.RulesDialog
Get number of players
getNumPlayers() - Method in class ie.errity.pd.Rules
 
getP() - Method in class ie.errity.pd.Rules
 
getPrimary1() - Method in class ie.errity.pd.graphics.EmeraldTheme
 
getPrimary2() - Method in class ie.errity.pd.graphics.EmeraldTheme
 
getPrimary3() - Method in class ie.errity.pd.graphics.EmeraldTheme
 
getPrisoner(int) - Method in class ie.errity.pd.graphics.MenuFrame
Get Prisoner from saved Prisoners list
getPrisoner(String) - Method in class ie.errity.pd.graphics.MenuFrame
Get Prisoner from saved Prisoners list
getR() - Method in class ie.errity.pd.Rules
 
getRand() - Static method in class ie.errity.pd.Prisoner
Returns a Prisoner with a random strategy
getRand(int) - Static method in class ie.errity.pd.Prisoner
Returns an array of Prisoners with random strategies
getRand(int, int) - Static method in class ie.errity.pd.Prisoner
Returns a 2D array of Prisoners with random strategies
getResults() - Method in class ie.errity.pd.Tournament
Returns the Tournament results
getRules() - Method in class ie.errity.pd.graphics.RulesDialog
Get Rules
getS() - Method in class ie.errity.pd.Rules
 
getScore() - Method in class ie.errity.pd.Prisoner
Returns the Prisoner's current score
getScores() - Method in class ie.errity.pd.Game
Get game results
getScores() - Method in class ie.errity.pd.genetic.Spatial
Get all player's scores
getSecondary1() - Method in class ie.errity.pd.graphics.EmeraldTheme
 
getSecondary2() - Method in class ie.errity.pd.graphics.EmeraldTheme
 
getSecondary3() - Method in class ie.errity.pd.graphics.EmeraldTheme
 
getStrat() - Method in class ie.errity.pd.Prisoner
Returns the Prisoner's strategy
getT() - Method in class ie.errity.pd.Rules
 
getText() - Method in class ie.errity.pd.graphics.SaveDialog
Get the typed text
getType() - Method in class ie.errity.pd.Prisoner
Return the strategy 'type' of the prisoner 0,1,2 signifies defecting ('nasty') strategies 5,6,7 signifies cooperating ('nice') strategies 3,4 indicates balanced strategies
getValue() - Method in class ie.errity.pd.graphics.SwingWorker
Get the value produced by the worker thread, or null if it hasn't been constructed yet.
GraphPanel - class ie.errity.pd.graphics.GraphPanel.
A 2D Line graph, displaying data from 3 sources
GraphPanel() - Constructor for class ie.errity.pd.graphics.GraphPanel
Create new Graph

H

hideDlg() - Method in class ie.errity.pd.graphics.StrategyDialog
Closes the dialog
hideDlg() - Method in class ie.errity.pd.graphics.SaveDialog
Closes the dialog
hideDlg() - Method in class ie.errity.pd.graphics.PrisonerDialog
Closes the dialog

I

ie.errity.pd - package ie.errity.pd
Provides classes for creating Prisoner Dilemma players and iterated games of the Prisoner Dilemma.
ie.errity.pd.genetic - package ie.errity.pd.genetic
Provides classes which provide genetic operations relevant to Prisoners and Prisoner Populations.
ie.errity.pd.graphics - package ie.errity.pd.graphics
Provides a set of Prisoner Dilemma user interface components.
InteractivePanel - class ie.errity.pd.graphics.InteractivePanel.
Interactive Prisoner's Dilemma Panel.
InteractivePanel(MenuFrame, String[]) - Constructor for class ie.errity.pd.graphics.InteractivePanel
Create new Interactive panel
interrupt() - Method in class ie.errity.pd.graphics.SwingWorker
A new method that interrupts the worker thread.

M

main(String[]) - Static method in class ie.errity.pd.epd
MAIN class.
Mate() - Method in class ie.errity.pd.genetic.Spatial
Evolve a new generation using a Genetic algorithm
maxResult() - Method in class ie.errity.pd.Tournament
Returns index of highest scoring individual
meanResult() - Method in class ie.errity.pd.Tournament
Returns the average score
MenuFrame - class ie.errity.pd.graphics.MenuFrame.
Main program frame, contains a menubar with options to configure rules settings, manage saved strategies and select the current type of game.
MenuFrame(String) - Constructor for class ie.errity.pd.graphics.MenuFrame
Create a new frame
minResult() - Method in class ie.errity.pd.Tournament
Returns index of lowest scoring individual
Moves - class ie.errity.pd.Moves.
Table of the 64 possible histories of a 3 game sequence, indexed by numbers from 0-63.
Moves() - Constructor for class ie.errity.pd.Moves
Creates a table of the 64 possible histories of a 3 game sequence, indexed by numbers from 0-63.
mutate(BitSet, double) - Static method in class ie.errity.pd.genetic.Genetic
Mutate (Flip a bit in the bitset) with probability mProb

P

paintComponent(Graphics) - Method in class ie.errity.pd.graphics.PayOffPanel
Called whenever the pane has to be repainted.
paintComponent(Graphics) - Method in class ie.errity.pd.graphics.GraphPanel
Called anytime the Graph needs to be redrawn
paintComponent(Graphics) - Method in class ie.errity.pd.genetic.Spatial
Responsible for painting the spatial grid to screen when neccesary
paintComponent(Graphics) - Method in class ie.errity.pd.genetic.Breeder
Responsible for updating the graphical representation
PayOffPanel - class ie.errity.pd.graphics.PayOffPanel.
Custom JPanel which displays the current payoff matrix as specified by the current Rules
Payoff matrix is displayed as:
PayOffPanel() - Constructor for class ie.errity.pd.graphics.PayOffPanel
Create new panel which displays the current payoff matrix as specified by the current Rules
Play() - Method in class ie.errity.pd.Tournament
Play the tournament
Play() - Method in class ie.errity.pd.Game
Play a game of IPD according to the rules
Play() - Method in class ie.errity.pd.genetic.Spatial
Every player plays the IPD against it's eight neighbours as goverend by the Rules
With a large number of players and/or a large number of iterations of each IPD Game this will be computationally demanding and may take some time to complete (depending on Hardware Specifications)
play(int, BitSet) - Method in class ie.errity.pd.Prisoner
Gets the Prisoner's next game move
Play(int, int) - Method in class ie.errity.pd.genetic.Spatial
Calculate Player (x,y)'s fitness by playing IPD against its neighbours (without speed optimization)
Prisoner - class ie.errity.pd.Prisoner.
This class represents a Prisoner with a strategy to play the Prisoner's Dilemma Game.
Prisoner(BitSet) - Constructor for class ie.errity.pd.Prisoner
Create a new Prisoner to play the prisoners dilemma (nameless)
Prisoner(String) - Constructor for class ie.errity.pd.Prisoner
Create a Predefined Prisoner
Prisoner(String, BitSet) - Constructor for class ie.errity.pd.Prisoner
Create a new Prisoner to play the prisoners dilemma
PrisonerDialog - class ie.errity.pd.graphics.PrisonerDialog.
A Dialog displaying a list with functions to allow the user to manage the list
PrisonerDialog(JFrame, String, String[]) - Constructor for class ie.errity.pd.graphics.PrisonerDialog
Create a new Prisoner dialog

R

refresh(int, int) - Method in class ie.errity.pd.genetic.Spatial
Calculate Player (x,y)'s fitness by playing IPD against its neighbours (with speed optimization)
Rules - class ie.errity.pd.Rules.
This class represents the rules for a Game of the Prisoner's Dilemma.
Rules() - Constructor for class ie.errity.pd.Rules
Default constructor
Initialises rules as follows: Game Iterations = 100, T = 5, S = 0, R = 3, P = 1, Mutation probability = .95, Generations = 250, Number of Players = 50,
Rules(int, int, int, int, int) - Constructor for class ie.errity.pd.Rules
Create new game rules with specified parameters
Rules(int, int, int, int, int, double, double) - Constructor for class ie.errity.pd.Rules
Create new game rules with specified parameters
Rules(int, int, int, int, int, double, double, int, int) - Constructor for class ie.errity.pd.Rules
Create new game rules with specified parameters
RulesDialog - class ie.errity.pd.graphics.RulesDialog.
A Dialog displaying a set of Rules with controls to modify the Rules
RulesDialog(MenuFrame) - Constructor for class ie.errity.pd.graphics.RulesDialog
Create a new Dialog displaying a set of Rules

S

save(String, Prisoner) - Method in class ie.errity.pd.graphics.MenuFrame
Save Prisoner in saved Prisoners list
SaveDialog - class ie.errity.pd.graphics.SaveDialog.
A Dialog which allows the user to enter a strategy name as text
SaveDialog(JFrame, JDialog, String) - Constructor for class ie.errity.pd.graphics.SaveDialog
Create a new Dialog which allows the user to enter a strategy name as text
scale(int[][]) - Static method in class ie.errity.pd.genetic.Genetic
Linear fitness scaling of a 2D array
scale(Prisoner[]) - Static method in class ie.errity.pd.genetic.Genetic
Linear fitness scaling of an array of Prisoners
Based on the Prisoner's Scores
scale(Prisoner[][]) - Static method in class ie.errity.pd.genetic.Genetic
Linear fitness scaling of a 2D array of Prisoners
Based on the Prisoner's Scores
setColors(Color, Color, Color) - Method in class ie.errity.pd.graphics.GraphPanel
Set Colors used to display the data
setCrossP(double) - Method in class ie.errity.pd.Rules
 
setGenerations(int) - Method in class ie.errity.pd.Rules
 
setIterations(int) - Method in class ie.errity.pd.Rules
 
setLabels(String, String, String, String) - Method in class ie.errity.pd.graphics.PayOffPanel
Set names to describe the payoffs
setLabels(String, String, String, String) - Method in class ie.errity.pd.graphics.GraphPanel
Set Labels used to describe the data
setMax(int) - Method in class ie.errity.pd.graphics.GraphPanel
Set the Y bounds, maximum data value possible
setMutateP(double) - Method in class ie.errity.pd.Rules
 
setNumPlayers(int) - Method in class ie.errity.pd.Rules
 
setP(int) - Method in class ie.errity.pd.Rules
 
setPayoffs(int, int, int, int) - Method in class ie.errity.pd.graphics.PayOffPanel
Set payoffs
setPlayers(Prisoner[][]) - Method in class ie.errity.pd.genetic.Spatial
Set the players on the grid
setR(int) - Method in class ie.errity.pd.Rules
 
setRules(Rules) - Method in class ie.errity.pd.graphics.TournamentPanel
Set the Rules
setRules(Rules) - Method in class ie.errity.pd.graphics.SpatialPanel
Set the Rules
setRules(Rules) - Method in class ie.errity.pd.graphics.MenuFrame
Set the Rules in each subwindow
setRules(Rules) - Method in class ie.errity.pd.graphics.InteractivePanel
Set the Rules
setRules(Rules) - Method in class ie.errity.pd.genetic.Spatial
Set the Rules
setRules(Rules) - Method in class ie.errity.pd.genetic.Breeder
Set the Rules
setS(int) - Method in class ie.errity.pd.Rules
 
setScore(int) - Method in class ie.errity.pd.Prisoner
Set the Prisoner's current score
setStrat(Prisoner) - Method in class ie.errity.pd.graphics.StrategyDialog
Set the displayed text
setT(int) - Method in class ie.errity.pd.Rules
 
showDlg() - Method in class ie.errity.pd.graphics.StrategyDialog
Opens the dialog
showDlg() - Method in class ie.errity.pd.graphics.SaveDialog
Opens the dialog
showDlg() - Method in class ie.errity.pd.graphics.RulesDialog
Opens the dialog
showDlg() - Method in class ie.errity.pd.graphics.PrisonerDialog
Opens the dialog
Spatial - class ie.errity.pd.genetic.Spatial.
Provides the ability to evolve a two dimensional grid of Prisoners.
Spatial() - Constructor for class ie.errity.pd.genetic.Spatial
Create a new 'Spatial grid' as described above
Spatial(Prisoner[][], Rules) - Constructor for class ie.errity.pd.genetic.Spatial
Create a new 'Spatial grid' of Prisoners as described above
SpatialPanel - class ie.errity.pd.graphics.SpatialPanel.
A Panel displaying the GUI for viewing and manipulating Spatial grid Evolution.
SpatialPanel(MenuFrame) - Constructor for class ie.errity.pd.graphics.SpatialPanel
Create new Spatial grid panel
start() - Method in class ie.errity.pd.graphics.TournamentPanel
Start Evolution
Runs in a seperated thread so GUI remains responsive
start() - Method in class ie.errity.pd.graphics.SwingWorker
Start the worker thread.
start() - Method in class ie.errity.pd.graphics.SpatialPanel
Start Evolution
Runs in a seperated thread so GUI remains responsive
stop() - Method in class ie.errity.pd.graphics.TournamentPanel
Stops Evolution
Ensures background thread is closed
stop() - Method in class ie.errity.pd.graphics.SpatialPanel
Stops Evolution
Ensures background thread is closed
StrategyDialog - class ie.errity.pd.graphics.StrategyDialog.
Dialog displaying a Prisoner's strategy
StrategyDialog(JFrame, JDialog, String) - Constructor for class ie.errity.pd.graphics.StrategyDialog
Create a new Dialog displaying a strategy
StrategyDialog(JFrame, String) - Constructor for class ie.errity.pd.graphics.StrategyDialog
Create a new Dialog displaying a strategy and the options to save the strategy or close
SwingWorker - class ie.errity.pd.graphics.SwingWorker.
This is the 3rd version of SwingWorker (also known as SwingWorker 3), an abstract class that you subclass to perform GUI-related work in a dedicated thread.
SwingWorker() - Constructor for class ie.errity.pd.graphics.SwingWorker
Start a thread that will call the construct method and then exit.

T

toString() - Method in class ie.errity.pd.Prisoner
Convert the Prisoner's strategy to a string of C's and D's
Tournament - class ie.errity.pd.Tournament.
Iterated Prisoner's Dilemma Tournament
In such a tournament every player plays the IPD against every other player and themselves.
Tournament(Prisoner[], Rules) - Constructor for class ie.errity.pd.Tournament
Create new Iterated Prisoner's Dilemma Tournament
TournamentPanel - class ie.errity.pd.graphics.TournamentPanel.
A Panel displaying the GUI for viewing and manipulating IPD Tournament Evolution.
TournamentPanel(MenuFrame) - Constructor for class ie.errity.pd.graphics.TournamentPanel
Create new Tournament panel
type(String) - Method in class ie.errity.pd.graphics.RulesDialog
Set type of Rules set to allow (Spatial or Tournament)

U

update(int, int) - Method in class ie.errity.pd.genetic.Spatial
Calculate the score of player (x,y) and refresh surrounding players to take changes into consideration
update(int, String) - Method in class ie.errity.pd.graphics.PrisonerDialog
Adds an element from the listbox
update(int, String) - Method in class ie.errity.pd.graphics.InteractivePanel
Adds an element from the listbox
updateScore(int) - Method in class ie.errity.pd.Prisoner
Adds value to the Prisoner's current score

V

view(int) - Method in class ie.errity.pd.graphics.MenuFrame
Display the selected strategy in a dialog box
view(int, JDialog) - Method in class ie.errity.pd.graphics.MenuFrame
Display the selected strategy in a dialog box (tied to a dialog)

A B C D E F G H I M P R S T U V
Andrew Errity [99086921]