Iterated Prisoner's Dilemma Emulator
Name
This repository provides an emulator for iterated prisoner's dilemma.
Description
You can run the program by the follow command:
cargo run
Results look like:
...
Strategy Score
AlwaysBetray 60044
AlwaysCooperate 67581
HalfToHalf 58721
TitForTat 76298
AlwaysRevenge 80016
You're encouraged to modify the source code especially to add new strategy.
To add a new strategy, you should create a new file under the src/strategy folder, implement the Strategy
Trait, and register it in the main.rs file.
- For a simple strategy example that doesn't care about opponents history, see the
AlwaysCooperate
strategy. - For a simple strategy example that thinks of opponents history, see the
TitForTat
strategy.
License
The bundle itself is licensed under the MIT license.
Reference
Thanks to The Evolution of Cooperation for theoretical background.