A Python library with the following principles and goals:
- Enabling the reproduction of previous Iterated Prisoner's Dilemma research as easily as possible.
- Creating the de-facto tool for future Iterated Prisoner's Dilemma research.
- Providing as simple a means as possible for anyone to define and contribute new and original Iterated Prisoner's Dilemma strategies.
- Emphasizing readability along with an open and welcoming community that is accommodating for developers and researchers of a variety of skill levels.
Currently the library contains well over 150 strategies including classics such as Tit-For-Tat (TFT) and Win-Stay-Lose-Shift (WSLS), recent variants including zero-determinant strategies, and a variety of novel strategies including several machine-learning based strategies. Many strategies are parameterized, allowing for infinitely-many variations. We welcome new strategies and additions from the literature: see #379 for a list of known strategies and sources.
With these strategies the library and can perform head-to-head Matches, a variety of tournament types (RoundRobin, Noisy, Spatially-distributed, and probabilistically ending) and population dynamics including the Moran process on graphs, while taking advantage of multi-core processors.
The library emphasizes reproducibility and validity. The current test suite covers more than 99% of all code in the library, with many portions covered many times over, including randomly generated tests that are created and run regularly.
Please contribute via pull request (or just get in touch with us).
For an overview of how to use and contribute to this repository, see the documentation: http://axelrod.readthedocs.org/
If you do use this library for your personal research we would love to hear about it: please do add a link at the bottom of this README file (PR's welcome or again, just let us know) :) If there is something that is missing in this library and that you would like implemented so as to be able to carry out a project please open an issue and let us know!
The simplest way to install is:
$ pip install axelrod
Otherwise:
$ git clone https://github.com/Axelrod-Python/Axelrod.git $ cd Axelrod $ python setup.py install
Note that on Ubuntu some users have had problems installing matplotlib. This seems to help with that:
sudo apt-get install libfreetype6-dev sudo apt-get install libpng12-0-dev
The full documentation can be found here: axelrod.readthedocs.org/.
The documentation includes details of how to setup a tournament but here is a brief example showing how to get a simple tournament:
>>> import axelrod as axl >>> axl.seed(0) # Set a seed >>> players = [s() for s in axl.demo_strategies] # Create players >>> tournament = axl.Tournament(players) # Create a tournament >>> results = tournament.play() # Play the tournament >>> results.ranked_names ['Defector', 'Grudger', 'Tit For Tat', 'Cooperator', 'Random: 0.5']
There is also a notebooks repository which shows further examples of using the library.
A tournament with the full set of strategies from the library can be found at https://github.com/Axelrod-Python/tournament. These results can be easily viewed at http://axelrod-tournament.readthedocs.org.
All contributions are welcome!
You can find helpful instructions about contributing in the documentation: http://axelrod.readthedocs.org/en/latest/tutorials/contributing/index.html
https://github.com/Axelrod-Python/Axelrod-notebooks contains a set of example Jupyter notebooks.
If you happen to use this library for anything from a blog post to a research paper please list it here:
- A 2015 pedagogic paper on active learning by drvinceknight published in MSOR Connections: the library is mentioned briefly as a way of demonstrating repeated games.
- A repository with various example tournaments and visualizations of strategies by marcharper.
- Axelrod-Python related blog articles by Uglyfruitcake.
- Evolving strategies for an Iterated Prisoner's Dilemma tournament by mojones.
- An Exploratory Data Analysis of the Iterated Prisoner's Dilemma, Part I and Part II by marcharper.
- Survival of the fittest: Experimenting with a high performing strategy in other environments by drvinceknight
- An open reproducible framework for the study of the iterated prisoner's dilemma: a pre print of a paper describing this library (20 authors).
The library has had many awesome contributions from many great contributors. The Core developers of the project are: