囚徒困境python框架Axelrod小试

  • 2019 年 10 月 6 日
  • 筆記

git库地址:https://github.com/Axelrod-Python/Axelrod

安装

pip3 install axelrod

Quick Start

$ python3  >>> 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']