A GameTheory library in it's making
# Imports
from gamethepy import Game
from gamethepy import RandomStrategyPlayer
from gamethepy.normal_form_games import PrisonersDilemmaGame
# Build the Game
players = [RandomStrategyPlayer() for _ in range(2)]
rules = PrisonersDilemmaGame()
game = Game(players=players, metric=rules)
# Play
results = game.turns(10)
# Outcome
results| PlayerA | PlayerB | |
|---|---|---|
| Turn | ||
| 0 | 2 | -1 |
| 1 | 1 | 1 |
| 2 | -2 | -2 |
| 3 | -1 | 2 |
| 4 | 2 | -1 |
| 5 | 1 | 1 |
| 6 | 2 | -1 |
| 7 | -2 | -2 |
| 8 | -2 | -2 |
| 9 | -2 | -2 |