sipd
simulate the spatial iterated Prisoner's Dilemma
sipd -help
or
sipd [-width integer] [-height integer] [-steps integer]
[-rounds integer] [-seed integer] [-CC double] [-CD
double] [-DC double] [-DD double] [-Iallc double]
[-Itft double] [-Irand double] [-Ipav double]
[-Ialld double] [-rcp double] [-noise double]
[-mute double] [-stats] [-inv] [-mag integer]
[-term string]
Simulates and plots the spatial iterated Prisoner's Dilemma over time according to the specified parameters. Each cell in a grid plays a specific strategy against its eight neighbors for several rounds. At the end of the last round, each cell copies the strategy of its most successful neighbor, which is then used for the next time step. Possible strategies include “Always-Cooperate,” “Always-Defect”, “Random,” “Pavlov,” and “Tit-for-Tat.”
The spatial iterated Prisoner's Dilemma is simulated and plotted over time according to the specified parameters. Each cell in a grid plays a specific strategy against its eight neighbors for several rounds. At the end of the last round, each cell copies the strategy of its most succesful neighbor, which is then used for the next time step. Possible strategies include 'Always Cooperate,' 'Always Defect,'
Payoffs
The payoff matrix for the Prisoner's Dilemma game is usually expressed as: Player B's Move +-----------+-----------+ Player A's Move | cooperate | defect | +-----------+-----------+-----------+ | cooperate | CC, CC | CD, DC | +-----------+-----------+-----------+ | defect | DC, CD | DD, DD | +-----------+-----------+-----------+
where the table entries are (A's payoff, B's payoff) and CC, CD, DC, and DD are the reward, sucker, temptation, and punish payoffs, respectively. For each of these four outcomes you will probably want the payoffs to reflect the relationships:
(DC > CC > DD > CD) and ((CD + DC) / 2 < CC).
Miscellany
The option for the probability of mutation (-mute) corresponds to the act of a cell spontaneously changing to a
randomly selected strategy independent of the outcome of the most recent set of rounds.
random noise (via the -noise option) manifests itself as a cell making a randomly selected move in a single round. In this case, both the cell whose action was altered as well as that cell's opponents "remember" what the random move was on the next round.
The value supplied with the -term option may be "none," in which case no graphic output is performed. This is useful if you simply want the statistics to be calculated for each time step (via the -stats option).
The initial population levels for all strategies will be normalized, so the scaling of the option values is irrelevant.
Bugs
No sanity checks are performed to make sure that any of the options make sense.
Options
-width | Width of world. | 100 |
-height | Height of world. | 100 |
-steps | Number of steps to simulate. | 10000000 |
-rounds | Number of rounds per step. | 5 |
-seed | Random seed for initial state. | 0 |
-CC | Reward Payoff. | 3.0 |
-CD | Sucker Payoff. | 0.0 |
-DC | Temptation Payoff. | 5.0 |
-DD | Punish Payoff. | 1.0 |
-Iallc | Initial population of All-C. | 0.2 |
-Itft | Initial population of TFT. | 0.2 |
-Irand | Initial population of Random. | 0.2 |
-Ipav | Initial population of Pavlov. | 0.2 |
-Ialld | Initial population of All-D. | 0.2 |
-rcp | Probability of C for Random strategy. | 0.5 |
-noise | Probability of noise. | 0.0 |
-mute | Probability of mutation. | 0.0 |
-stats | Print statistics? | False |
-inv | Invert all colors? | False |
-mag | Magnification factor. | 1 |
-term | How to plot points. | None |