The Computational Beauty of Nature
Source code

eipd

simulate the ecological iterated Prisoner's Dilemma

eipd -help
  or
eipd   [-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]

Simulates the ecological iterated Prisoner's Dilemma over time according to the specified parameters. At every time step the population of each strategy is calculated as a function of the expected scores earned against all strategies weighted by the populations of the opponents. Possible strategies include “Always-Cooperate,” “Always-Defect,” “Random,” “Pavlov,” and “Tit-for-Tat.”

The ecological iterated Prisoner's Dilemma is simulated over time according to the specified parameters. At every time step the population of each strategy is calculated as a function of the expected scores earned against all strategies weighted by the populations of the opponents. 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

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.

During each time step, every strategy plays against every other strategy as well as against itself.

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

-stepsNumber of steps to simulate.100000
-roundsNumber of rounds per step.10
-seedRandom seed for initial state.0
-CCReward Payoff.3.0
-CDSucker Payoff.0.0
-DCTemptation Payoff.5.0
-DDPunish Payoff.1.0
-IallcInitial population of All-C.0.2
-ItftInitial population of TFT.0.2
-IrandInitial population of Random.0.2
-IpavInitial population of Pavlov.0.2
-IalldInitial population of All-D.0.2
-rcpProbability of C for Random strategy.0.5
-noiseProbability of noise.0.0

eipd.c on GitHub