https://github.com/willf/prisoner
Iterative Prisoners' Dilemma tournament (Clojure)
https://github.com/willf/prisoner
Last synced: about 1 year ago
JSON representation
Iterative Prisoners' Dilemma tournament (Clojure)
- Host: GitHub
- URL: https://github.com/willf/prisoner
- Owner: willf
- Created: 2012-07-30T05:57:46.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2022-02-06T20:34:21.000Z (over 4 years ago)
- Last Synced: 2025-03-24T12:52:25.846Z (about 1 year ago)
- Language: Python
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Iterative Prisoners' Dilemma tournament
## Python
For now:
$ python prisoner.py -1
```
usage: prisoner.py [-h] [--rounds ROUNDS] [--random RANDOM] [--titfortat TITFORTAT] [--eviltitfortat EVILTITFORTAT]
[--cooperator COOPERATOR] [--defector DEFECTOR] [--titfortwotats TITFORTWOTATS] [--oneplayer]
Play a tournament of Prisoners Dilemma
optional arguments:
-h, --help show this help message and exit
--rounds ROUNDS Number of rounds in the tournament
--random RANDOM, -r RANDOM
Number of random players to add to the tournament
--titfortat TITFORTAT, -t TITFORTAT
Number of titfortat players to add to the tournament
--eviltitfortat EVILTITFORTAT, -e EVILTITFORTAT
Number of evil titfortat players to add to the tournament
--cooperator COOPERATOR, -c COOPERATOR
Number of cooperator players to add to the tournament
--defector DEFECTOR, -d DEFECTOR
Number of defector players to add to the tournament
--titfortwotats TITFORTWOTATS, -2 TITFORTWOTATS
Number of titfortwotats players to add to the tournament
--oneplayer, -1 Add one player of each type to the tournament
```
Modify the code to create new players, etc.
## Clojure
For now:
$ lein repl
> (load "prisoner")
> (tourney 1000 (concat (create-players) (create-players)))
To create a new player:
(1) write the code — use tit-for-tat as an example
(2) add to (create-players) function for ease of access
TODO:
- probably best to fix how deep the history goes back
- add Press/Dyson players