Like everybody else I have been fascinated with the the Iterated Prisoner's Dilemma (Wikipedia
ever since I read The Evolution of Cooperation
, Robert Axelrod's classic book on the subject.
An even more famous book that deals with the IPD is Dawkins' The Selfish Gene. Who has read either of these books and did not think 'Would I be able to come up with a strategy that can outsmart the legendary champion TITFORTAT'??
If you think the IPD ends with Axelrod you should also read that Wikipedia page.
Even though there is a mighty fine Python recreation
I could not resist
having a go at it myself. For a lowly PHP programmer like me this is a rare chance to not just tiptoe on the shoulders of giants (Freeman Dyson! John Maynard Smith!!) but to play with them as well (the giants not their shoulders).
There are 3 ways of playing the IPD here: each has its own 'PLAY' button. Try them.
The image above shows the trajectory of 2 players after 200 rounds (from left to right) where every downward move indicates a defection.
The image below shows what happens to the average score when all strategies in this implementation of the IPD compere in a 'scratch' tournament.
The strategy that has the lowest average score at the end of every round is removed from the track (the 'scratch' is a discipline in track cycling),
the score is calculated by matching every strategy against every other strategy, itself included, for 200 rounds. What happens is clear and confirming the original Axelrod tournaments:
the nice guys win as the ones looking for a cheap advantage to bring them above the magic three-points-average will ultimately fail to find a strategy to exploit.
Interestingly even a completely stupid strategy like COOPERATE makes it to the finish line, supported by having enough strategies around to make it do well against those that will exploit it fully.
Mail me your strategy, invite me to your tournament: wilfried at selborne dot nl.