[image of digits]

Iterated Prisoners' Dilemma - CodeGear C++ Builder 6 Applications

Two suspects are apprehended after a bank robbery. We know they are both involved but may have some difficulty proving their guilt. We take each suspect to a different interrogation room and make each one an offer to turn state's evidence. We say privately to each suspect,

"If you confess and implicate your partner before he confesses, we will give you 5 years off your mandatory sentence. If he confesses first then he gets 5 years off and you get no break on the time your serve. If you both confess at the same time you each get only 1 year off. If you both keep quiet, I'm afraid you'll each get 3 years off since we'll have difficulty establishing your guilt."

So if one prisoner "rats out" on the other, he gets a payoff of 5 and the other gets 0. If both prisoners cooperate with one another and say nothing, each gets a payoff of 3. If they both implicate each other the both get a payoff of 1 apiece. The prisoners know the game. What should they do?

The games below assume a community of agents with different strategies for playing the game, playing it with one another many times. The strategies are always Cooperate, Tit-for-Tat (T for T), Tit-for-Two-Tats (T for 2T), random, alternate and always Defect.

2006 Evolutionary Iterated Prisoners Dilemma
An evolutionary enhanced version of the classic game.
Evolution is achieved by randomly changing the strategy of the worst player every 100 games.
Devolution is achieved by randomly changing the strategy of the best player every 100 games.
Evolution changes the screen to a pale green.
Devolution changes the screen to a pale pink.
A high not is played when an evolutionary change is made. A lower note is played when a devolutionary change is made.

Iterated Prisoners Dilemma - 2006

An evolution option has been included, which selects a random strategy for the poorest player every 100 iterations.

An option to turn off rendering has also been included so that experiments may be run more quickly.

Games will now run up to a maximum of 500,000 iterations. At that setting, on average, each player will play 20,000 times and play each other player 800 times.

Alternative visualization options have been deleted.

To do: Show the population of each strategy through time.

Executable
Project Files Zipped

Unit 1.cpp Source Code
Unit1.h Source Code


Payoff Matrix
Cooperate
Defect
Cooperate
3, 3
5, 0
Defect
0, 5
1, 1

With a beginning ratio of 4:4:4:4:4:6
run through 500,000 iterations with evolution.
Local Memory
Global Memory
Run 1

Total Score = 2783941

Total Score = 2386013
Run 2

Total Score = 2244088

Total Score = 2683428

Is this system sensitive to initial conditions? Try setting the first population to all Cooperators or all Defectors. Is there any difference in the outcome?

Garret's Evolutionary Iterated Prisoners Dilemma
An evolutionary enhanced version of the classic game.
This version will not work without Borland installed.

Iterated Prisoners Dilemma - 2005
One of six strategies may be selected for each of 25 agents and agents may use either local or global memories. Strategies are visualized by the outline color while individual scores are represented by the interior. Circles have popup boxes giving details of each agent. Shapes may be randomly placed or rearranged and may be moved by clicking on them and then clicking on an empty square. An array of shape objects is utilized.

Executable
Project Files Zipped

Unit 1.cpp Source Code
Unit1.h Source Code


Payoff Matrix
Cooperate
Defect
Cooperate
3, 3
5, 0
Defect
0, 5
1, 1

Iterated Prisoners Dilemma - 2004
One of six strategies may be selected for each of 24 agents. Strategies are visualized by the shape of the representation while individual scores are represented along a color spectrum. Shapes have popup boxes giving details of each agent. Shapes may be randomly placed or ordered and may be moved by clicking on them and then clicking on an empty square. An array of shape objects is utilized.

Executable
Project Files Zipped

Unit 1.cpp Source Code
Unit1.h Source Code


Payoff Matrix
Cooperate
Defect
Cooperate
3, 3
5, 0
Defect
0, 5
1, 1

Agents as Shapes
A Visualization Framework for Iterated Prisoners'Dilemma
This is the visualization "shell" for a simulation of Iterated Prisoners' Dilemma. Shapes are used to visualize 24 agents in a world array of 10 by 10. Mousing over the shapes or the cells will display the correct agent and array indices, respectively. Clicking on an shape, then clicking on the screen will move that shape and its underlaying agent to a new position on the screen and in the array.

The simulation code has not been written, so Run, Step and Stop have no content.

Executable
Project Files Zipped

Unit 1.cpp Source Code
Unit1.h Source Code


Payoff Matrix
Cooperate
Defect
Cooperate
3, 3
5, 0
Defect
0, 5
1, 1

Agents as Images
A Visualization for Iterated Prisoners'Dilemma
24 images are used to visualize 24 agents in a world array of 10 by 10. Mousing over the images or the cells will display the correct agent and array indices, respectively. Clicking on an image, then clicking on the screen will move that image and its underlaying agent to a new position on the screen and in the array.

The simulation code has not been written, so Run, Step and Stop have no content. The executable will not run unless it is in the same folder as ALL the images. So save all these to the same file before running the application.

Executable
Unit 1.cpp Source Code
Unit1.h Source Code

Project Files Zipped
Images Set 1 Zipped
Images Set 2 Zipped


Payoff Matrix
Cooperate
Defect
Cooperate
3, 3
5, 0
Defect
0, 5
1, 1