Jason Cawley
Wolfram Science Group
Phoenix, AZ USA
Registered: Aug 2003
Posts: 712 
Iterated Prisoner's Dilemma in Mathematica
I've posted in the past about the evolutionary game theory subject and on iterated prisoner's dilemma (IPD for short) in particular. After an email question, I thought I'd post an update about it and a code notebook for working on IPD in Mathematica.
The notebook attached covers two different sets ups for IPD  spatial game theory in 2D, and all vs all game theory, where everyone plays everyone else in the population once in each round, effectively (round robin).
As in the Axelrod tradition, the idea is that each player runs several rounds with each of its neighbors in either set up, and keeps a cumulative score against all of them. Each player is using some identified strategy. The best performing strategy gets new adherents, at the expense of ones doing less well (locally, in the spatial case).
One is then interested in evolutionary stability questions, like which rules are "fitter" in which population backgrounds, what configurations of strategies are stable, and the like.
The rules investigated first are simple "one lookback" rules, which consider only their own and their partner's immediately preceeding move, in determining what to do next themselves. Tit for Tat, for example, just does whatever the other fellow just did. The payoff matrix is the standard one for PD.
The code in the notebook will generate the strategies for longer lookbacks and score them, but hasn't (yet, it isn't hard to extend it) pregenerated the scores for each pair for larger strategy sets, which is a prerequisite for looking at them spatially or in weighted populations, all vs. all. So the full investigation is done only for the 1lookback case, but is readily extensible.
Comments welcome, and I hope this is interesting.
Attachment: ipd.nb
This has been downloaded 1441 time(s).
Report this post to a moderator  IP: Logged
