Prisoner’s Dilemma Tournament
A classic, the iterated prisoner’s dilemma (or tournament) is a fun and relatively simple way to “run a simulation”. One of the reasons of course why it’s so popular to test a language or framework, a person’s qualifications or intelligence or some thoughts you might have yourself on the subject.
A discussion with a friend triggered regained interest. It was about why, when and which strategies are most successful. And if we can draw any conclusions from this or Game Theory in general about human behavior and/or human societies.
Since running a game is so straightforward and player strategies are (mostly) very simple functions I decided to code it in javascript. Yes, I know there are a million versions already, but I had some special requirements. Extensive game debugging and the possibility to add custom strategies.
Right now adding a strategy would be done in the separate JS players file, either on CodePen or on GitHub.
CodePen
See the Pen Prisoner’s Dilemma Tournament by Status201 (@status201) on CodePen
Github
See the code on GitHub. Feel free to fork or make a pull request!