Kernel: Python 2 (Ubuntu Linux)
Iterated Prisoner's Dilemma
Game class for 2-player Iterated Prisoner's Dilemma. One can modify the number of rounds and the miscommunication chance.
In [1]:
Nice player always cooperates.
In [2]:
Mean player always cheats.
In [3]:
Grudge player starts by cooperating, but if you cheat, it will cheat back forever.
In [4]:
Copycat player starts by cooperating and then repeats whatever the other player did last.
In [5]:
Forgiving copycat player starts by cooperating and then cheats back only if cheated twice in a row.
In [6]:
Simple copycat player starts by cooperating. If you cheat, it does the opposite of what it did last. If you cooperate, it repeats whatever it did last.
In [7]:
In [8]:
Number of rounds: 10
Miscommunication chance: 5%
Copycat Player score: 21
Forgiving Copycat Player score: 17
[21, 17]
In [15]:
['Mean Player', 465]
['Mean Player', 465]
['Mean Player', 465]
['Mean Player', 465]
['Mean Player', 465]
['Copycat Player', 375]
['Copycat Player', 375]
['Copycat Player', 375]
['Copycat Player', 375]
['Copycat Player', 375]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
['Nice Player', 330]
In [0]: