From 89afd2c1b44fa4bf11d49eeb9bc62381725c09aa Mon Sep 17 00:00:00 2001 From: YibingJ Date: Fri, 15 Mar 2024 20:50:10 -0400 Subject: [PATCH 01/13] added and implemented epsilon_greedy.py --- axelrod/strategies/epsilon_greedy.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 axelrod/strategies/epsilon_greedy.py diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py new file mode 100644 index 000000000..e69de29bb From 273b2afe7d1cc315e11f0c0d4418c55d6405419d Mon Sep 17 00:00:00 2001 From: YibingJ Date: Fri, 15 Mar 2024 20:51:00 -0400 Subject: [PATCH 02/13] added and implemented epsilon_greedy.py --- axelrod/strategies/epsilon_greedy.py | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py index e69de29bb..8e8278209 100644 --- a/axelrod/strategies/epsilon_greedy.py +++ b/axelrod/strategies/epsilon_greedy.py @@ -0,0 +1,88 @@ +from axelrod.action import Action +from axelrod.player import Player + +C, D = Action.C, Action.D + + +class EpsilonGreedy(Player): + """ + Behaves greedily (chooses the optimal action) with a probability of 1 - epsilon, + and chooses randomly between the actions with a probability of epsilon. + + The optimal action is determined from the average payoff of each action in previous turns. + + Names: + + # TODO: reference Sutton & Barto's Reinforcement Learning: an Introduction + """ + + name = "$\varepsilon$-greedy" + classifier = { + "memory_depth": float("inf"), + "stochastic": True, + "long_run_time": False, + "inspects_source": False, + "manipulates_source": False, + "manipulates_state": False, + } + + def __init__( + self, + epsilon: float = 0.1, + init_c_reward: float = 0.0, + init_d_reward: float = 0.0, + ) -> None: + """ + Parameters + ---------- + epsilon + 0.0 <= epsilon <= 1.0 + the probability that the player will "explore" (act uniformly random); defaults to 0.1 + init_c_reward + initial expected utility from action C; defaults to 0.0. + init_d_reward + initial expected utility from action D; defaults to 0.0 + + Special cases + ---------- + epsilon = 0 is equal to Random(0.5) + """ + super().__init__() + self.epsilon = epsilon + + # treat out of range values as extremes + if epsilon <= 0: + self.epsilon = 0.0 + if epsilon >= 1: + self.epsilon = 1.0 + + self._rewards = {C: init_c_reward, D: init_d_reward} + + def _post_init(self): + super()._post_init() + if self.epsilon == 0: + self.classifier["stochastic"] = False + + def update_rewards(self, opponent: Player): + game = self.match_attributes["game"] + last_round = (self.history[-1], opponent.history[-1]) + last_play = self.history[-1] + last_score = game.score(last_round)[0] + + # update the expected rewards based on previous play + num_plays = ( + self.cooperations() if last_play == C else self.defections() + ) + self._rewards[last_play] = self._rewards[last_play] + ( + 1 / num_plays + ) * (last_score - self._rewards[last_play]) + + def strategy(self, opponent: Player) -> Action: + """Actual strategy definition that determines player's action.""" + + # explore + if self._random.uniform(0.0, 1.0) <= self.epsilon: + return self._random.random_choice() + # exploit + else: + return max(self._rewards, key=self._rewards.get) From b8d1fe0d12d96e5f78d8718e9e23dbc7f3cd6446 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:59:58 -0400 Subject: [PATCH 03/13] added and implemented epsilon_greedy.py --- axelrod/strategies/epsilon_greedy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py index 8e8278209..57dae2187 100644 --- a/axelrod/strategies/epsilon_greedy.py +++ b/axelrod/strategies/epsilon_greedy.py @@ -13,7 +13,7 @@ class EpsilonGreedy(Player): Names: - # TODO: reference Sutton & Barto's Reinforcement Learning: an Introduction + # TODO: reference Sutton & Barto's Reinforcement Learning: an Introduction 2nd Ed. """ name = "$\varepsilon$-greedy" From 6f578aab8ee5e5a672165cefa6454f8997bce1d8 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:21:34 -0400 Subject: [PATCH 04/13] epsilon-greedy added to _strategies.py and reference\strategy_index.rst --- axelrod/data/all_classifiers.yml | 4035 ++++++++++++++--------------- axelrod/strategies/_strategies.py | 2 + docs/reference/strategy_index.rst | 2 + 3 files changed, 2005 insertions(+), 2034 deletions(-) diff --git a/axelrod/data/all_classifiers.yml b/axelrod/data/all_classifiers.yml index ea52f2351..0e26c8118 100644 --- a/axelrod/data/all_classifiers.yml +++ b/axelrod/data/all_classifiers.yml @@ -1,2034 +1,2001 @@ -$\phi$: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -$\pi$: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -$e$: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -ALLCorALLD: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -AON2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -Adaptive: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Adaptive Pavlov 2006: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Adaptive Pavlov 2011: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Adaptive Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -AdaptorBrief: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -AdaptorLong: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Aggravater: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Alexei: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Alternator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -Alternator Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Anti Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -AntiCycler: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Appeaser: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Arrogant QLearner: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Average Copier: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -BackStabber: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Better and Better: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Bully: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -Bush Mosteller: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Calculator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Cautious QLearner: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -CollectiveStrategy: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Contrite Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -Cooperator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 0 - stochastic: false -Cooperator Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Cycle Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Cycler CCCCCD: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: false -Cycler CCCD: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -Cycler CCCDCD: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: false -Cycler CCD: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -Cycler DC: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -Cycler DDC: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -DBS: - inspects_source: false - long_run_time: true - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Darwin: - inspects_source: true - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: true - memory_depth: .inf - stochastic: false -Defector: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 0 - stochastic: false -Defector Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Delayed AON1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -Desperate: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Detective: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -DoubleCrosser: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -DoubleResurrection: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: false -Doubler: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Dynamic Two Tits For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -EasyGo: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -EugineNier: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Eventual Cycle Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved ANN: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved ANN 5: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved ANN 5 Noise 05: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved FSM 16: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved FSM 16 Noise 05: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved FSM 4: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Evolved HMM 5: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: true -EvolvedLookerUp1_1_1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -EvolvedLookerUp2_2_2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Firm But Fair: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -First by Anonymous: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 0 - stochastic: true -First by Davis: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -First by Downing: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -First by Feld: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 200 - stochastic: true -First by Graaskamp: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -First by Grofman: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -First by Joss: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -First by Nydegger: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -First by Shubik: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -First by Stein and Rapoport: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -First by Tideman and Chieruzzi: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -First by Tullock: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Fool Me Once: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Forgetful Fool Me Once: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Forgetful Grudger: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 10 - stochastic: false -Forgiver: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Forgiving Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Fortress3: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -Fortress4: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -GTFT: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Geller: - inspects_source: true - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Geller Cooperator: - inspects_source: true - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Geller Defector: - inspects_source: true - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -General Soft Grudger: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Go By Majority: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Go By Majority 10: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 10 - stochastic: false -Go By Majority 20: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 20 - stochastic: false -Go By Majority 40: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 40 - stochastic: false -Go By Majority 5: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: false -Gradual: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Gradual Killer: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Grudger: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -GrudgerAlternator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Grumpy: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Handshake: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Hard Go By Majority: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Hard Go By Majority 10: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 10 - stochastic: false -Hard Go By Majority 20: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 20 - stochastic: false -Hard Go By Majority 40: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 40 - stochastic: false -Hard Go By Majority 5: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: false -Hard Prober: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Hard Tit For 2 Tats: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -Hard Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -Hesitant QLearner: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Hopeless: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Inverse: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Inverse Punisher: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Knowledgeable Worse and Worse: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Level Punisher: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Limited Retaliate: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Limited Retaliate 2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Limited Retaliate 3: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -MEM2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Math Constant Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Memory Decay: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Meta Hunter Aggressive: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Meta Majority: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Majority Finite Memory: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Majority Long Memory: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Majority Memory One: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Minority: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Mixer: - inspects_source: false - long_run_time: true - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner Deterministic: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner Ensemble: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner Finite Memory: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner Long Memory: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner Memory One: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Meta Winner Stochastic: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Michaelos: - inspects_source: false - long_run_time: false - makes_use_of: !!set - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Mind Bender: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: true - manipulates_state: false - memory_depth: -10 - stochastic: false -Mind Controller: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: true - manipulates_state: false - memory_depth: -10 - stochastic: false -Mind Reader: - inspects_source: true - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Mind Warper: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: true - manipulates_state: false - memory_depth: -10 - stochastic: false -Mirror Mind Reader: - inspects_source: true - long_run_time: false - makes_use_of: !!set {} - manipulates_source: true - manipulates_state: false - memory_depth: .inf - stochastic: false -N Tit(s) For M Tat(s): - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -NMWE Deterministic: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -NMWE Finite Memory: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -NMWE Long Memory: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -NMWE Memory One: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -NMWE Stochastic: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Naive Prober: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Negation: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Nice Average Copier: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Nice Meta Winner: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Nice Meta Winner Ensemble: - inspects_source: false - long_run_time: true - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Omega TFT: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Once Bitten: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 12 - stochastic: false -Opposite Grudger: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Original Gradual: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -PSO Gambler 1_1_1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -PSO Gambler 2_2_2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -PSO Gambler 2_2_2 Noise 05: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -PSO Gambler Mem1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Predator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Prober: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Prober 2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Prober 3: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Prober 4: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Protected Mind Reader: - inspects_source: true - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: true - manipulates_state: false - memory_depth: .inf - stochastic: false -Pun1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Punisher: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Raider: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Random: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 0 - stochastic: true -Random Hunter: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Random Tit for Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Remorseful Prober: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: true -Resurrection: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: false -Retaliate: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Retaliate 2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Retaliate 3: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Revised Downing: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Ripoff: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: false -Risky QLearner: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Appold: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Black: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 5 - stochastic: true -Second by Borufsen: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by Cave: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Champion: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Colbert: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 4 - stochastic: false -Second by Eatherley: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Getzler: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Gladstein: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by GraaskampKatzen: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by Grofman: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 8 - stochastic: false -Second by Harrington: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Kluepfel: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Leyvraz: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 3 - stochastic: true -Second by Mikkelson: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by RichardHufford: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by Rowsam: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by Tester: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by Tideman and Chieruzzi: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by Tranquilizer: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Weiner: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by White: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Second by WmAdams: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Second by Yamachi: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -SelfSteem: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -ShortMem: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Slow Tit For Two Tats 2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -Sneaky Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Soft Grudger: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 6 - stochastic: false -Soft Joss: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -SolutionB1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -SolutionB5: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Spiteful Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Stalker: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - length: null - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Stochastic Cooperator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Stochastic WSLS: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Suspicious Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -TF1: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -TF2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -TF3: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -ThueMorse: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -ThueMorseInverse: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Thumper: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Tit For 2 Tats: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -Tit For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -Tricky Cooperator: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 10 - stochastic: false -Tricky Defector: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Tricky Level Punisher: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Two Tits For Tat: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: false -UsuallyCooperates: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -UsuallyDefects: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -VeryBad: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Willing: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -Win-Shift Lose-Stay: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -Win-Stay Lose-Shift: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: false -Winner12: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Winner21: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: false -Worse and Worse: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Worse and Worse 2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -Worse and Worse 3: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: .inf - stochastic: true -ZD-Extort-2: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-Extort-2 v2: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-Extort-4: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-Extort3: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-Extortion: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-GEN-2: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-GTFT-2: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-Mem2: - inspects_source: false - long_run_time: false - makes_use_of: !!set {} - manipulates_source: false - manipulates_state: false - memory_depth: 2 - stochastic: true -ZD-Mischief: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true -ZD-SET-2: - inspects_source: false - long_run_time: false - makes_use_of: !!set - game: null - manipulates_source: false - manipulates_state: false - memory_depth: 1 - stochastic: true +"$\varepsilon$-greedy": + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +$\phi$: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +$\pi$: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +$e$: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +ALLCorALLD: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +AON2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +Adaptive: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Adaptive Pavlov 2006: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Adaptive Pavlov 2011: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Adaptive Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +AdaptorBrief: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +AdaptorLong: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Aggravater: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Alexei: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Alternator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +Alternator Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Anti Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +AntiCycler: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Appeaser: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Arrogant QLearner: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Average Copier: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +BackStabber: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Better and Better: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Bully: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +Burn Both Ends: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Bush Mosteller: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +CAPRI: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +Calculator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Cautious QLearner: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +CollectiveStrategy: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Contrite Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +Cooperator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 0 + stochastic: false +Cooperator Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Cycle Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Cycler CCCCCD: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: false +Cycler CCCD: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +Cycler CCCDCD: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: false +Cycler CCD: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +Cycler DC: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +Cycler DDC: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +DBS: + inspects_source: false + long_run_time: true + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Darwin: + inspects_source: true + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: true + memory_depth: .inf + stochastic: false +Defector: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 0 + stochastic: false +Defector Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Delayed AON1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +Desperate: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Detective: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +DoubleCrosser: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +DoubleResurrection: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: false +Doubler: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Dynamic Two Tits For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +EasyGo: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +EugineNier: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Eventual Cycle Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved ANN: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved ANN 5: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved ANN 5 Noise 05: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved FSM 16: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved FSM 16 Noise 05: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved FSM 4: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved FSM 6: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Evolved HMM 5: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: true +EvolvedLookerUp1_1_1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +EvolvedLookerUp2_2_2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Firm But Fair: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +First by Anonymous: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 0 + stochastic: true +First by Davis: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +First by Downing: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +First by Feld: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 200 + stochastic: true +First by Graaskamp: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +First by Grofman: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +First by Joss: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +First by Nydegger: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +First by Shubik: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +First by Stein and Rapoport: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +First by Tideman and Chieruzzi: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +First by Tullock: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Fool Me Once: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Forgetful Fool Me Once: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Forgetful Grudger: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 10 + stochastic: false +Forgiver: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Forgiving Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Fortress3: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +Fortress4: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +GTFT: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +General Soft Grudger: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Go By Majority: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Go By Majority 10: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 10 + stochastic: false +Go By Majority 20: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 20 + stochastic: false +Go By Majority 40: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 40 + stochastic: false +Go By Majority 5: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: false +Gradual: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Gradual Killer: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Grudger: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +GrudgerAlternator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Grumpy: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Handshake: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Hard Go By Majority: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Hard Go By Majority 10: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 10 + stochastic: false +Hard Go By Majority 20: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 20 + stochastic: false +Hard Go By Majority 40: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 40 + stochastic: false +Hard Go By Majority 5: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: false +Hard Prober: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Hard Tit For 2 Tats: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +Hard Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +Hesitant QLearner: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Hopeless: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Inverse: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Inverse Punisher: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Knowledgeable Worse and Worse: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Level Punisher: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Limited Retaliate: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Limited Retaliate 2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Limited Retaliate 3: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +MEM2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Math Constant Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Memory Decay: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Meta Hunter Aggressive: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Meta Majority: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Majority Finite Memory: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Majority Long Memory: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Majority Memory One: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Minority: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Mixer: + inspects_source: false + long_run_time: true + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner Deterministic: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner Ensemble: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner Finite Memory: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner Long Memory: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner Memory One: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Meta Winner Stochastic: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Michaelos: + inspects_source: false + long_run_time: false + makes_use_of: !!set + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +N Tit(s) For M Tat(s): + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +NMWE Deterministic: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +NMWE Finite Memory: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +NMWE Long Memory: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +NMWE Memory One: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +NMWE Stochastic: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Naive Prober: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Negation: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Nice Average Copier: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Nice Meta Winner: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Nice Meta Winner Ensemble: + inspects_source: false + long_run_time: true + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Omega TFT: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Once Bitten: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 12 + stochastic: false +Opposite Grudger: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Original Gradual: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +PSO Gambler 1_1_1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +PSO Gambler 2_2_2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +PSO Gambler 2_2_2 Noise 05: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +PSO Gambler Mem1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Predator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Prober: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Prober 2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Prober 3: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Prober 4: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Pun1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Punisher: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Raider: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Random: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 0 + stochastic: true +Random Hunter: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Random Tit for Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Remorseful Prober: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: true +Resurrection: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: false +Retaliate: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Retaliate 2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Retaliate 3: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Revised Downing: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Ripoff: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: false +Risky QLearner: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Appold: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Black: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 5 + stochastic: true +Second by Borufsen: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by Cave: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Champion: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Colbert: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 4 + stochastic: false +Second by Eatherley: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Getzler: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Gladstein: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by GraaskampKatzen: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by Grofman: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 8 + stochastic: false +Second by Harrington: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Kluepfel: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Leyvraz: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 3 + stochastic: true +Second by Mikkelson: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by RichardHufford: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by Rowsam: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by Tester: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by Tideman and Chieruzzi: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by Tranquilizer: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Weiner: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by White: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Second by WmAdams: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Second by Yamachi: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +SelfSteem: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +ShortMem: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Slow Tit For Two Tats 2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +Sneaky Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Soft Grudger: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 6 + stochastic: false +Soft Joss: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +SolutionB1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +SolutionB5: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Spiteful Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +SpitefulCC: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Stalker: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + length: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Stochastic Cooperator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Stochastic WSLS: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Suspicious Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +TF1: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +TF2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +TF3: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +ThueMorse: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +ThueMorseInverse: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Thumper: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Tit For 2 Tats: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +Tit For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +Tricky Cooperator: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 10 + stochastic: false +Tricky Defector: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Tricky Level Punisher: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Two Tits For Tat: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: false +UsuallyCooperates: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +UsuallyDefects: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +VeryBad: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Willing: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +Win-Shift Lose-Stay: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +Win-Stay Lose-Shift: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: false +Winner12: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Winner21: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false +Worse and Worse: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Worse and Worse 2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +Worse and Worse 3: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: true +ZD-Extort-2: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-Extort-2 v2: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-Extort-4: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-Extort3: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-Extortion: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-GEN-2: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-GTFT-2: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-Mem2: + inspects_source: false + long_run_time: false + makes_use_of: !!set {} + manipulates_source: false + manipulates_state: false + memory_depth: 2 + stochastic: true +ZD-Mischief: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true +ZD-SET-2: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: 1 + stochastic: true diff --git a/axelrod/strategies/_strategies.py b/axelrod/strategies/_strategies.py index 92dafc523..e7fe5a31a 100644 --- a/axelrod/strategies/_strategies.py +++ b/axelrod/strategies/_strategies.py @@ -89,6 +89,7 @@ from .dbs import DBS from .defector import Defector, TrickyDefector from .doubler import Doubler +from .epsilon_greedy import EpsilonGreedy from .finite_state_machines import ( TF1, TF2, @@ -343,6 +344,7 @@ Doubler, DynamicTwoTitsForTat, EasyGo, + EpsilonGreedy, EugineNier, EventualCycleHunter, EvolvedANN, diff --git a/docs/reference/strategy_index.rst b/docs/reference/strategy_index.rst index 6732be88c..bf916594d 100644 --- a/docs/reference/strategy_index.rst +++ b/docs/reference/strategy_index.rst @@ -48,6 +48,8 @@ Here are the docstrings of all the strategies in the library. :members: .. automodule:: axelrod.strategies.forgiver :members: +.. automodule:: axelrod.strategies.epsilon_greedy + :members: .. automodule:: axelrod.strategies.gambler :members: .. automodule:: axelrod.strategies.gobymajority From f60dbaf6ec870d218da611f25b5c2192a3fcdb0a Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Fri, 15 Mar 2024 22:28:44 -0400 Subject: [PATCH 05/13] Fixed update_rewards() to correctly refer to attributes, added test file --- axelrod/strategies/epsilon_greedy.py | 11 ++++++-- .../tests/strategies/test_epsilon_greedy.py | 28 +++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 axelrod/tests/strategies/test_epsilon_greedy.py diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py index 57dae2187..c8e38e0b0 100644 --- a/axelrod/strategies/epsilon_greedy.py +++ b/axelrod/strategies/epsilon_greedy.py @@ -70,15 +70,20 @@ def update_rewards(self, opponent: Player): last_score = game.score(last_round)[0] # update the expected rewards based on previous play - num_plays = ( - self.cooperations() if last_play == C else self.defections() - ) + if last_play == C: + num_plays = self.history.cooperations + else: + num_plays = self.history.defections + self._rewards[last_play] = self._rewards[last_play] + ( 1 / num_plays ) * (last_score - self._rewards[last_play]) def strategy(self, opponent: Player) -> Action: """Actual strategy definition that determines player's action.""" + # if not the first turn + if len(self.history) != 0: + self.update_rewards(opponent) # explore if self._random.uniform(0.0, 1.0) <= self.epsilon: diff --git a/axelrod/tests/strategies/test_epsilon_greedy.py b/axelrod/tests/strategies/test_epsilon_greedy.py new file mode 100644 index 000000000..f2545b3e9 --- /dev/null +++ b/axelrod/tests/strategies/test_epsilon_greedy.py @@ -0,0 +1,28 @@ +"""Tests for the epsilon greedy strategy.""" + +import axelrod as axl + +from .test_player import TestPlayer + +C, D = axl.Action.C, axl.Action.D + + +class TestEpsilonGreedy(TestPlayer): + + name = "$\varepsilon$-greedy" + player = axl.EpsilonGreedy + expected_classifier = { + "memory_depth": float("inf"), + "stochastic": True, + "makes_use_of": {"game"}, + "long_run_time": False, + "inspects_source": False, + "manipulates_source": False, + "manipulates_state": False, + } + + def test_random(self): + """Test that strategy is randomly picked (not affected by history).""" + opponent = axl.MockPlayer() + actions = [(C, C), (C, D), (C, D), (C, C), (C, D)] + self.versus_test(opponent, expected_actions=actions, seed=0, init_kwargs={"epsilon": 1}) From faaf84b016a7ec8e0651279ea0543f29dd383687 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Sat, 16 Mar 2024 00:12:44 -0400 Subject: [PATCH 06/13] random test created and passed, basic deterministic tests created and passed --- axelrod/strategies/epsilon_greedy.py | 2 +- .../tests/strategies/test_epsilon_greedy.py | 62 +++++++++++++++++-- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py index c8e38e0b0..266555324 100644 --- a/axelrod/strategies/epsilon_greedy.py +++ b/axelrod/strategies/epsilon_greedy.py @@ -86,7 +86,7 @@ def strategy(self, opponent: Player) -> Action: self.update_rewards(opponent) # explore - if self._random.uniform(0.0, 1.0) <= self.epsilon: + if self.epsilon > 0 and self._random.uniform(0.0, 1.0) <= self.epsilon: return self._random.random_choice() # exploit else: diff --git a/axelrod/tests/strategies/test_epsilon_greedy.py b/axelrod/tests/strategies/test_epsilon_greedy.py index f2545b3e9..030962a36 100644 --- a/axelrod/tests/strategies/test_epsilon_greedy.py +++ b/axelrod/tests/strategies/test_epsilon_greedy.py @@ -2,7 +2,7 @@ import axelrod as axl -from .test_player import TestPlayer +from .test_player import TestPlayer, TestMatch C, D = axl.Action.C, axl.Action.D @@ -21,8 +21,62 @@ class TestEpsilonGreedy(TestPlayer): "manipulates_state": False, } + def test_deterministic(self): + # cases where epsilon = 0 + actions = [(C, C), (C, C), (C, C)] + self.versus_test(axl.Cooperator(), + expected_actions=actions, + init_kwargs={"epsilon": 0, "init_c_reward": 0, "init_d_reward": -1}, + attrs={"_rewards": {C: 3, D: -1}}) + + actions = [(D, D), (D, D), (D, D)] + self.versus_test(axl.Defector(), + expected_actions=actions, + init_kwargs={"epsilon": 0, "init_c_reward": -1, "init_d_reward": 0}, + attrs={"_rewards": {C: -1, D: 1}}) + + # actions = [(D, C), (D, D)] + # self.versus_test(axl.TitForTat(), + # expected_actions=actions, + # init_kwargs={"epsilon": 0, "init_c_reward": 3.2, "init_d_reward": 4}, + # attrs={"_rewards": {C: 3.2, D: 9}}) + def test_random(self): - """Test that strategy is randomly picked (not affected by history).""" + # case where epsilon = 1 opponent = axl.MockPlayer() - actions = [(C, C), (C, D), (C, D), (C, C), (C, D)] - self.versus_test(opponent, expected_actions=actions, seed=0, init_kwargs={"epsilon": 1}) + actions = [(C, C), (D, C), (D, C), (C, C)] + self.versus_test(opponent, expected_actions=actions, init_kwargs={"epsilon": 1}, seed=5) + + + # def versus_test( + # self, + # opponent, + # expected_actions, + # turns=None, + # noise=None, + # seed=None, + # match_attributes=None, + # attrs=None, + # init_kwargs=None, + # ): + # + # if init_kwargs is None: + # init_kwargs = dict() + # + # player = self.player(**init_kwargs) + # + # test_match = TestMatch() + # seed = test_match.search_seeds( + # player, + # opponent, + # [x for (x, y) in expected_actions], + # [y for (x, y) in expected_actions], + # turns=turns, + # noise=noise, + # seed=seed, + # attrs=attrs, + # match_attributes=match_attributes, + # ) + # self.assertIsNotNone(seed) + # print(seed) + # From a9b20a072ae10ac5190a24069841e97c62857919 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Sat, 16 Mar 2024 14:44:24 -0400 Subject: [PATCH 07/13] strategy tests completed and passedl; updated docstring to clarify initial behaviour. --- axelrod/strategies/epsilon_greedy.py | 12 +- .../tests/strategies/test_epsilon_greedy.py | 104 ++++++++++-------- 2 files changed, 63 insertions(+), 53 deletions(-) diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py index 266555324..1d0ba4bd8 100644 --- a/axelrod/strategies/epsilon_greedy.py +++ b/axelrod/strategies/epsilon_greedy.py @@ -9,7 +9,9 @@ class EpsilonGreedy(Player): Behaves greedily (chooses the optimal action) with a probability of 1 - epsilon, and chooses randomly between the actions with a probability of epsilon. - The optimal action is determined from the average payoff of each action in previous turns. + The optimal action is determined from the average payoff of each action in previous turns; + if initial rewards for each action are equivalent (true by default), + then the optimal action for the first turn is cooperate. Names: @@ -45,7 +47,7 @@ def __init__( Special cases ---------- - epsilon = 0 is equal to Random(0.5) + When epsilon <= 0, this player behaves like Random(0.5) """ super().__init__() self.epsilon = epsilon @@ -75,9 +77,9 @@ def update_rewards(self, opponent: Player): else: num_plays = self.history.defections - self._rewards[last_play] = self._rewards[last_play] + ( - 1 / num_plays - ) * (last_score - self._rewards[last_play]) + self._rewards[last_play] = self._rewards[last_play] + (1 / num_plays) * ( + last_score - self._rewards[last_play] + ) def strategy(self, opponent: Player) -> Action: """Actual strategy definition that determines player's action.""" diff --git a/axelrod/tests/strategies/test_epsilon_greedy.py b/axelrod/tests/strategies/test_epsilon_greedy.py index 030962a36..6895a6e0a 100644 --- a/axelrod/tests/strategies/test_epsilon_greedy.py +++ b/axelrod/tests/strategies/test_epsilon_greedy.py @@ -9,7 +9,7 @@ class TestEpsilonGreedy(TestPlayer): - name = "$\varepsilon$-greedy" + name = "$\varepsilon$-greedy: 0.1, 0.0, 0.0" player = axl.EpsilonGreedy expected_classifier = { "memory_depth": float("inf"), @@ -24,59 +24,67 @@ class TestEpsilonGreedy(TestPlayer): def test_deterministic(self): # cases where epsilon = 0 actions = [(C, C), (C, C), (C, C)] - self.versus_test(axl.Cooperator(), - expected_actions=actions, - init_kwargs={"epsilon": 0, "init_c_reward": 0, "init_d_reward": -1}, - attrs={"_rewards": {C: 3, D: -1}}) + self.versus_test( + axl.Cooperator(), + expected_actions=actions, + init_kwargs={"epsilon": 0, "init_c_reward": 0, "init_d_reward": -1}, + attrs={"_rewards": {C: 3, D: -1}}, + ) actions = [(D, D), (D, D), (D, D)] - self.versus_test(axl.Defector(), - expected_actions=actions, - init_kwargs={"epsilon": 0, "init_c_reward": -1, "init_d_reward": 0}, - attrs={"_rewards": {C: -1, D: 1}}) + self.versus_test( + axl.Defector(), + expected_actions=actions, + init_kwargs={"epsilon": 0, "init_c_reward": -1, "init_d_reward": 0}, + attrs={"_rewards": {C: -1, D: 1}}, + ) - # actions = [(D, C), (D, D)] - # self.versus_test(axl.TitForTat(), - # expected_actions=actions, - # init_kwargs={"epsilon": 0, "init_c_reward": 3.2, "init_d_reward": 4}, - # attrs={"_rewards": {C: 3.2, D: 9}}) + actions = [(D, C), (D, D), (C, D)] + self.versus_test( + axl.TitForTat(), + expected_actions=actions, + init_kwargs={"epsilon": 0, "init_c_reward": 3.2, "init_d_reward": 4.0}, + attrs={"_rewards": {C: 3.2, D: 3.0}}, + ) def test_random(self): - # case where epsilon = 1 + # cases where epsilon = 1 opponent = axl.MockPlayer() actions = [(C, C), (D, C), (D, C), (C, C)] - self.versus_test(opponent, expected_actions=actions, init_kwargs={"epsilon": 1}, seed=5) + self.versus_test( + opponent, expected_actions=actions, init_kwargs={"epsilon": 1}, seed=5 + ) + opponent = axl.MockPlayer(actions=[C, D, C]) + actions = [(D, C), (C, D), (C, C)] + self.versus_test( + opponent, expected_actions=actions, init_kwargs={"epsilon": 1.0}, seed=1 + ) - # def versus_test( - # self, - # opponent, - # expected_actions, - # turns=None, - # noise=None, - # seed=None, - # match_attributes=None, - # attrs=None, - # init_kwargs=None, - # ): - # - # if init_kwargs is None: - # init_kwargs = dict() - # - # player = self.player(**init_kwargs) - # - # test_match = TestMatch() - # seed = test_match.search_seeds( - # player, - # opponent, - # [x for (x, y) in expected_actions], - # [y for (x, y) in expected_actions], - # turns=turns, - # noise=noise, - # seed=seed, - # attrs=attrs, - # match_attributes=match_attributes, - # ) - # self.assertIsNotNone(seed) - # print(seed) - # + def test_strategy(self): + # sometimes explores + actions = [(C, C), (D, C), (D, C)] + self.versus_test( + axl.Cooperator(), + expected_actions=actions, + attrs={"_rewards": {C: 3, D: 5}}, + seed=21, + ) + + # always explores + actions = [(D, D), (C, D), (C, D)] + self.versus_test( + axl.Defector(), + expected_actions=actions, + attrs={"_rewards": {C: 0, D: 1}}, + seed=13741, + ) + + # never explores/always exploits + actions = [(C, C), (C, C), (C, C)] + self.versus_test( + axl.TitForTat(), + expected_actions=actions, + attrs={"_rewards": {C: 3, D: 0}}, + seed=1, + ) From b135871dbed9498924a37141e44ade7c8f305ed9 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:22:55 -0400 Subject: [PATCH 08/13] References correctly added and docstring updated with correct Name. --- axelrod/strategies/epsilon_greedy.py | 2 +- docs/reference/bibliography.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py index 1d0ba4bd8..3e8b220f9 100644 --- a/axelrod/strategies/epsilon_greedy.py +++ b/axelrod/strategies/epsilon_greedy.py @@ -15,7 +15,7 @@ class EpsilonGreedy(Player): Names: - # TODO: reference Sutton & Barto's Reinforcement Learning: an Introduction 2nd Ed. + - Epsilon-greedy: [Sutton2018]_ """ name = "$\varepsilon$-greedy" diff --git a/docs/reference/bibliography.rst b/docs/reference/bibliography.rst index c6f1a3a9b..4c7a56eb5 100644 --- a/docs/reference/bibliography.rst +++ b/docs/reference/bibliography.rst @@ -63,6 +63,7 @@ documentation. .. [Shakarian2013] Shakarian, P., Roos, P. & Moores, G. A Novel Analytical Method for Evolutionary Graph Theory Problems. .. [Slany2007] Slany W. and Kienreich W., On some winning strategies for the iterated prisoner’s dilemma, in Kendall G., Yao X. and Chong S. (eds.) The iterated prisoner’s dilemma: 20 years on. World Scientific, chapter 8, pp. 171-204, 2007. .. [Stewart2012] Stewart, a. J., & Plotkin, J. B. (2012). Extortion and cooperation in the Prisoner’s Dilemma. Proceedings of the National Academy of Sciences, 109(26), 10134–10135. http://doi.org/10.1073/pnas.1208087109 +.. [Sutton2018] Sutton, R. S., & Barto, A. G. (2018). Multi-armed Bandits. In Reinforcement Learning: An Introduction (2nd ed., pp. 25–45). MIT Press. http://incompleteideas.net/book/the-book-2nd.html .. [Szabo2007] Szabó, G., & Fáth, G. (2007). Evolutionary games on graphs. Physics Reports, 446(4-6), 97–216. http://doi.org/10.1016/j.physrep.2007.04.004 .. [Gaudesi2016] Gaudesi, Marco, et al. "Exploiting evolutionary modeling to prevail in iterated prisoner’s dilemma tournaments." IEEE Transactions on Computational Intelligence and AI in Games 8.3 (2016): 288-300. .. [Tzafestas2000] Tzafestas, E. (2000). Toward adaptive cooperative behavior. From Animals to Animals: Proceedings of the 6th International Conference on the Simulation of Adaptive Behavior {(SAB-2000)}, 2, 334–340. From a8abca2313d335fd8e96b0efe0c2af69675825a5 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Sat, 16 Mar 2024 18:09:02 -0400 Subject: [PATCH 09/13] for extendability: renamed module to armed_bandits, created Greedy superclass of EpsilonGreedy, and implemented option to weigh reward based on recency --- axelrod/data/all_classifiers.yml | 9 ++ axelrod/strategies/_strategies.py | 3 +- axelrod/strategies/armed_bandits.py | 151 ++++++++++++++++++ axelrod/strategies/epsilon_greedy.py | 95 ----------- ...psilon_greedy.py => test_armed_bandits.py} | 0 docs/reference/strategy_index.rst | 4 +- 6 files changed, 164 insertions(+), 98 deletions(-) create mode 100644 axelrod/strategies/armed_bandits.py delete mode 100644 axelrod/strategies/epsilon_greedy.py rename axelrod/tests/strategies/{test_epsilon_greedy.py => test_armed_bandits.py} (100%) diff --git a/axelrod/data/all_classifiers.yml b/axelrod/data/all_classifiers.yml index 0e26c8118..c0608beea 100644 --- a/axelrod/data/all_classifiers.yml +++ b/axelrod/data/all_classifiers.yml @@ -1999,3 +1999,12 @@ ZD-SET-2: manipulates_state: false memory_depth: 1 stochastic: true +greedy: + inspects_source: false + long_run_time: false + makes_use_of: !!set + game: null + manipulates_source: false + manipulates_state: false + memory_depth: .inf + stochastic: false diff --git a/axelrod/strategies/_strategies.py b/axelrod/strategies/_strategies.py index e7fe5a31a..33f83664b 100644 --- a/axelrod/strategies/_strategies.py +++ b/axelrod/strategies/_strategies.py @@ -89,7 +89,7 @@ from .dbs import DBS from .defector import Defector, TrickyDefector from .doubler import Doubler -from .epsilon_greedy import EpsilonGreedy +from .armed_bandits import Greedy, EpsilonGreedy from .finite_state_machines import ( TF1, TF2, @@ -387,6 +387,7 @@ Golden, Gradual, GradualKiller, + Greedy, Grudger, GrudgerAlternator, Grumpy, diff --git a/axelrod/strategies/armed_bandits.py b/axelrod/strategies/armed_bandits.py new file mode 100644 index 000000000..d74bf9990 --- /dev/null +++ b/axelrod/strategies/armed_bandits.py @@ -0,0 +1,151 @@ +import math + +from axelrod.action import Action +from axelrod.player import Player + +C, D = Action.C, Action.D + + +class Greedy(Player): + """ + A player that always chooses the optimal action based on the average reward of each action from previous turns. + + If initial rewards for each action are equivalent (true by default), + then the optimal action for the first turn is cooperate. + + Names: + + - Greedy: [Sutton2018]_ + """ + + name = "greedy" + classifier = { + "memory_depth": float("inf"), + "stochastic": False, + "long_run_time": False, + "inspects_source": False, + "manipulates_source": False, + "manipulates_state": False, + } + + UNIFORM = float("-inf") # constant that replaces weight when rewards aren't weighted + + def __init__( + self, + init_c_reward: float = 0.0, + init_d_reward: float = 0.0, + recency_weight: float = UNIFORM + ) -> None: + """ + Parameters + ---------- + init_c_reward + Initial expected utility from action C; defaults to 0.0. + init_d_reward + Initial expected utility from action D; defaults to 0.0 + recency_weight + 0.0 <= recency_weight <= 1.0 + The exponential recency weight used in calculating the average reward. + If this argument is not provided, the player will not weigh rewards based on recency. + """ + super().__init__() + self._rewards = {C: init_c_reward, D: init_d_reward} + self.weight = recency_weight + + # treat out of range values as extremes + if (not math.isinf(self.weight)) and (self.weight <= 0): + self.weight = 0.0 + if recency_weight >= 1: + self.weight = 1.0 + + def update_rewards(self, opponent: Player): + """Updates the expected reward associated with the last action.""" + game = self.match_attributes["game"] + last_round = (self.history[-1], opponent.history[-1]) + last_play = self.history[-1] + last_score = game.score(last_round)[0] + + # if UNIFORM, use 1 / total number of times the updated action was taken previously + if math.isinf(self.weight): + weight = self.history.cooperations if last_play == C else self.defections + else: + weight = self.weight + + self._rewards[last_play] = self._rewards[last_play] + weight * ( + last_score - self._rewards[last_play] + ) + + def strategy(self, opponent: Player) -> Action: + """Actual strategy definition that determines player's action.""" + # if not the first turn + if len(self.history) != 0: + self.update_rewards(opponent) + + # select the optimal play + return max(self._rewards, key=self._rewards.get) + + +class EpsilonGreedy(Greedy): + """ + Has a 1 - epsilon probability of behaving like Greedy(), and plays randomly otherwise. + + Names: + + - Epsilon-greedy: [Sutton2018]_ + """ + + name = "$\varepsilon$-greedy" + classifier = { + "memory_depth": float("inf"), + "stochastic": True, + "long_run_time": False, + "inspects_source": False, + "manipulates_source": False, + "manipulates_state": False, + } + + def __init__( + self, + epsilon: float = 0.1, + init_c_reward: float = 0.0, + init_d_reward: float = 0.0, + ) -> None: + """ + Parameters + ---------- + epsilon + 0.0 <= epsilon <= 1.0 + the probability that the player will "explore" (act uniformly random); defaults to 0.1 + init_c_reward + initial expected utility from action C; defaults to 0.0. + init_d_reward + initial expected utility from action D; defaults to 0.0 + + Special cases + ---------- + When epsilon <= 0, this player behaves like Random(0.5) + When epsilon >= 1, this player behaves like Greedy() + """ + super().__init__(init_c_reward, init_d_reward) + self.epsilon = epsilon + + # treat out of range values as extremes + if epsilon <= 0: + self.epsilon = 0.0 + if epsilon >= 1: + self.epsilon = 1.0 + + def _post_init(self): + super()._post_init() + if self.epsilon == 0: + self.classifier["stochastic"] = False + + def strategy(self, opponent: Player) -> Action: + """Actual strategy definition that determines player's action.""" + + # explore + if self.epsilon > 0 and self._random.uniform(0.0, 1.0) <= self.epsilon: + return self._random.random_choice() + # exploit + else: + return super().strategy(opponent) diff --git a/axelrod/strategies/epsilon_greedy.py b/axelrod/strategies/epsilon_greedy.py deleted file mode 100644 index 3e8b220f9..000000000 --- a/axelrod/strategies/epsilon_greedy.py +++ /dev/null @@ -1,95 +0,0 @@ -from axelrod.action import Action -from axelrod.player import Player - -C, D = Action.C, Action.D - - -class EpsilonGreedy(Player): - """ - Behaves greedily (chooses the optimal action) with a probability of 1 - epsilon, - and chooses randomly between the actions with a probability of epsilon. - - The optimal action is determined from the average payoff of each action in previous turns; - if initial rewards for each action are equivalent (true by default), - then the optimal action for the first turn is cooperate. - - Names: - - - Epsilon-greedy: [Sutton2018]_ - """ - - name = "$\varepsilon$-greedy" - classifier = { - "memory_depth": float("inf"), - "stochastic": True, - "long_run_time": False, - "inspects_source": False, - "manipulates_source": False, - "manipulates_state": False, - } - - def __init__( - self, - epsilon: float = 0.1, - init_c_reward: float = 0.0, - init_d_reward: float = 0.0, - ) -> None: - """ - Parameters - ---------- - epsilon - 0.0 <= epsilon <= 1.0 - the probability that the player will "explore" (act uniformly random); defaults to 0.1 - init_c_reward - initial expected utility from action C; defaults to 0.0. - init_d_reward - initial expected utility from action D; defaults to 0.0 - - Special cases - ---------- - When epsilon <= 0, this player behaves like Random(0.5) - """ - super().__init__() - self.epsilon = epsilon - - # treat out of range values as extremes - if epsilon <= 0: - self.epsilon = 0.0 - if epsilon >= 1: - self.epsilon = 1.0 - - self._rewards = {C: init_c_reward, D: init_d_reward} - - def _post_init(self): - super()._post_init() - if self.epsilon == 0: - self.classifier["stochastic"] = False - - def update_rewards(self, opponent: Player): - game = self.match_attributes["game"] - last_round = (self.history[-1], opponent.history[-1]) - last_play = self.history[-1] - last_score = game.score(last_round)[0] - - # update the expected rewards based on previous play - if last_play == C: - num_plays = self.history.cooperations - else: - num_plays = self.history.defections - - self._rewards[last_play] = self._rewards[last_play] + (1 / num_plays) * ( - last_score - self._rewards[last_play] - ) - - def strategy(self, opponent: Player) -> Action: - """Actual strategy definition that determines player's action.""" - # if not the first turn - if len(self.history) != 0: - self.update_rewards(opponent) - - # explore - if self.epsilon > 0 and self._random.uniform(0.0, 1.0) <= self.epsilon: - return self._random.random_choice() - # exploit - else: - return max(self._rewards, key=self._rewards.get) diff --git a/axelrod/tests/strategies/test_epsilon_greedy.py b/axelrod/tests/strategies/test_armed_bandits.py similarity index 100% rename from axelrod/tests/strategies/test_epsilon_greedy.py rename to axelrod/tests/strategies/test_armed_bandits.py diff --git a/docs/reference/strategy_index.rst b/docs/reference/strategy_index.rst index bf916594d..103e01238 100644 --- a/docs/reference/strategy_index.rst +++ b/docs/reference/strategy_index.rst @@ -18,6 +18,8 @@ Here are the docstrings of all the strategies in the library. :members: .. automodule:: axelrod.strategies.appeaser :members: +.. automodule:: axelrod.strategies.armed_bandits + :members: .. automodule:: axelrod.strategies.averagecopier :members: .. automodule:: axelrod.strategies.axelrod_first @@ -48,8 +50,6 @@ Here are the docstrings of all the strategies in the library. :members: .. automodule:: axelrod.strategies.forgiver :members: -.. automodule:: axelrod.strategies.epsilon_greedy - :members: .. automodule:: axelrod.strategies.gambler :members: .. automodule:: axelrod.strategies.gobymajority From 17af03134508287c72a7421fe8af9ce7ebb1bd52 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Sat, 16 Mar 2024 19:27:42 -0400 Subject: [PATCH 10/13] modified UNIFORM to use np.inf instead; fixed EpsilonGreedy.strategy() so that it correctly calls update_rewards() through the parent method; all previous tests passed. --- axelrod/strategies/armed_bandits.py | 21 +++++----- .../tests/strategies/test_armed_bandits.py | 39 +++++++++++++++++-- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/axelrod/strategies/armed_bandits.py b/axelrod/strategies/armed_bandits.py index d74bf9990..66a775bb7 100644 --- a/axelrod/strategies/armed_bandits.py +++ b/axelrod/strategies/armed_bandits.py @@ -1,4 +1,4 @@ -import math +import numpy as np from axelrod.action import Action from axelrod.player import Player @@ -28,7 +28,7 @@ class Greedy(Player): "manipulates_state": False, } - UNIFORM = float("-inf") # constant that replaces weight when rewards aren't weighted + UNIFORM = np.inf # constant that replaces weight when rewards aren't weighted def __init__( self, @@ -53,9 +53,9 @@ def __init__( self.weight = recency_weight # treat out of range values as extremes - if (not math.isinf(self.weight)) and (self.weight <= 0): + if self.weight <= 0: self.weight = 0.0 - if recency_weight >= 1: + if (not np.isinf(self.weight)) and (self.weight >= 1): self.weight = 1.0 def update_rewards(self, opponent: Player): @@ -66,8 +66,8 @@ def update_rewards(self, opponent: Player): last_score = game.score(last_round)[0] # if UNIFORM, use 1 / total number of times the updated action was taken previously - if math.isinf(self.weight): - weight = self.history.cooperations if last_play == C else self.defections + if np.isinf(self.weight): + weight = 1 / (self.history.cooperations if last_play == C else self.history.defections) else: weight = self.weight @@ -109,6 +109,7 @@ def __init__( epsilon: float = 0.1, init_c_reward: float = 0.0, init_d_reward: float = 0.0, + recency_weight: float = Greedy.UNIFORM ) -> None: """ Parameters @@ -126,7 +127,7 @@ def __init__( When epsilon <= 0, this player behaves like Random(0.5) When epsilon >= 1, this player behaves like Greedy() """ - super().__init__(init_c_reward, init_d_reward) + super().__init__(init_c_reward, init_d_reward, recency_weight) self.epsilon = epsilon # treat out of range values as extremes @@ -142,10 +143,12 @@ def _post_init(self): def strategy(self, opponent: Player) -> Action: """Actual strategy definition that determines player's action.""" + # this will also update the reward appropriately + greedy_action = super().strategy(opponent) # explore - if self.epsilon > 0 and self._random.uniform(0.0, 1.0) <= self.epsilon: + if self.epsilon > 0 and self._random.uniform() <= self.epsilon: return self._random.random_choice() # exploit else: - return super().strategy(opponent) + return greedy_action diff --git a/axelrod/tests/strategies/test_armed_bandits.py b/axelrod/tests/strategies/test_armed_bandits.py index 6895a6e0a..48f07fd4c 100644 --- a/axelrod/tests/strategies/test_armed_bandits.py +++ b/axelrod/tests/strategies/test_armed_bandits.py @@ -1,4 +1,4 @@ -"""Tests for the epsilon greedy strategy.""" +"""Tests for the armed bandits strategies.""" import axelrod as axl @@ -9,7 +9,7 @@ class TestEpsilonGreedy(TestPlayer): - name = "$\varepsilon$-greedy: 0.1, 0.0, 0.0" + name = "$\varepsilon$-greedy: 0.1, 0.0, 0.0, inf" player = axl.EpsilonGreedy expected_classifier = { "memory_depth": float("inf"), @@ -67,8 +67,9 @@ def test_strategy(self): self.versus_test( axl.Cooperator(), expected_actions=actions, + init_kwargs={"epsilon": 0.5}, attrs={"_rewards": {C: 3, D: 5}}, - seed=21, + seed=2, ) # always explores @@ -88,3 +89,35 @@ def test_strategy(self): attrs={"_rewards": {C: 3, D: 0}}, seed=1, ) + + # temporary overriding function used to search for seeds + # def versus_test( + # self, + # opponent, + # expected_actions, + # turns=None, + # noise=None, + # seed=None, + # match_attributes=None, + # attrs=None, + # init_kwargs=None, + # ): + # + # if init_kwargs is None: + # init_kwargs = dict() + # + # player = self.player(**init_kwargs) + # + # test_match = TestMatch() + # seed = test_match.search_seeds( + # player, + # opponent, + # [x for (x, y) in expected_actions], + # [y for (x, y) in expected_actions], + # turns=turns, + # noise=noise, + # seed=seed, + # attrs=attrs, + # match_attributes=match_attributes, + # ) + # self.assertIsNotNone(seed) From ab947a82edd4ad3e323a6d93de7678f2d0b946f1 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Sat, 16 Mar 2024 19:29:09 -0400 Subject: [PATCH 11/13] formatted armed_bandits.py using black. --- axelrod/strategies/armed_bandits.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/axelrod/strategies/armed_bandits.py b/axelrod/strategies/armed_bandits.py index 66a775bb7..66e6d7a39 100644 --- a/axelrod/strategies/armed_bandits.py +++ b/axelrod/strategies/armed_bandits.py @@ -34,7 +34,7 @@ def __init__( self, init_c_reward: float = 0.0, init_d_reward: float = 0.0, - recency_weight: float = UNIFORM + recency_weight: float = UNIFORM, ) -> None: """ Parameters @@ -67,7 +67,9 @@ def update_rewards(self, opponent: Player): # if UNIFORM, use 1 / total number of times the updated action was taken previously if np.isinf(self.weight): - weight = 1 / (self.history.cooperations if last_play == C else self.history.defections) + weight = 1 / ( + self.history.cooperations if last_play == C else self.history.defections + ) else: weight = self.weight @@ -109,7 +111,7 @@ def __init__( epsilon: float = 0.1, init_c_reward: float = 0.0, init_d_reward: float = 0.0, - recency_weight: float = Greedy.UNIFORM + recency_weight: float = Greedy.UNIFORM, ) -> None: """ Parameters From 80fbe79974711fbc94205e85131e2a8436cfd074 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:38:43 -0400 Subject: [PATCH 12/13] style changes in docstrings and comments, renamed file to bandits, updated doc test, and changed value of UNIFORM constant to -1. --- axelrod/strategies/_strategies.py | 2 +- .../{armed_bandits.py => bandits.py} | 16 ++++------ .../tests/strategies/test_armed_bandits.py | 32 ------------------- docs/index.rst | 2 +- docs/reference/strategy_index.rst | 2 +- 5 files changed, 10 insertions(+), 44 deletions(-) rename axelrod/strategies/{armed_bandits.py => bandits.py} (87%) diff --git a/axelrod/strategies/_strategies.py b/axelrod/strategies/_strategies.py index 33f83664b..2f2b6f84c 100644 --- a/axelrod/strategies/_strategies.py +++ b/axelrod/strategies/_strategies.py @@ -89,7 +89,7 @@ from .dbs import DBS from .defector import Defector, TrickyDefector from .doubler import Doubler -from .armed_bandits import Greedy, EpsilonGreedy +from .bandits import Greedy, EpsilonGreedy from .finite_state_machines import ( TF1, TF2, diff --git a/axelrod/strategies/armed_bandits.py b/axelrod/strategies/bandits.py similarity index 87% rename from axelrod/strategies/armed_bandits.py rename to axelrod/strategies/bandits.py index 66e6d7a39..a41b6480b 100644 --- a/axelrod/strategies/armed_bandits.py +++ b/axelrod/strategies/bandits.py @@ -28,7 +28,7 @@ class Greedy(Player): "manipulates_state": False, } - UNIFORM = np.inf # constant that replaces weight when rewards aren't weighted + UNIFORM = -1.0 # constant that replaces weight when rewards aren't weighted def __init__( self, @@ -46,16 +46,16 @@ def __init__( recency_weight 0.0 <= recency_weight <= 1.0 The exponential recency weight used in calculating the average reward. - If this argument is not provided, the player will not weigh rewards based on recency. + If this argument is equal to -1 or is not provided, the player will not weigh rewards based on recency. """ super().__init__() self._rewards = {C: init_c_reward, D: init_d_reward} self.weight = recency_weight - # treat out of range values as extremes - if self.weight <= 0: + # limit parameter value range + if (self.weight != self.UNIFORM) and self.weight <= 0: self.weight = 0.0 - if (not np.isinf(self.weight)) and (self.weight >= 1): + if self.weight >= 1: self.weight = 1.0 def update_rewards(self, opponent: Player): @@ -66,7 +66,7 @@ def update_rewards(self, opponent: Player): last_score = game.score(last_round)[0] # if UNIFORM, use 1 / total number of times the updated action was taken previously - if np.isinf(self.weight): + if self.weight == self.UNIFORM: weight = 1 / ( self.history.cooperations if last_play == C else self.history.defections ) @@ -78,7 +78,6 @@ def update_rewards(self, opponent: Player): ) def strategy(self, opponent: Player) -> Action: - """Actual strategy definition that determines player's action.""" # if not the first turn if len(self.history) != 0: self.update_rewards(opponent) @@ -89,7 +88,7 @@ def strategy(self, opponent: Player) -> Action: class EpsilonGreedy(Greedy): """ - Has a 1 - epsilon probability of behaving like Greedy(), and plays randomly otherwise. + Has a 1 - epsilon probability of behaving like Greedy; otherwise, randomly choose to cooperate or defect. Names: @@ -144,7 +143,6 @@ def _post_init(self): self.classifier["stochastic"] = False def strategy(self, opponent: Player) -> Action: - """Actual strategy definition that determines player's action.""" # this will also update the reward appropriately greedy_action = super().strategy(opponent) diff --git a/axelrod/tests/strategies/test_armed_bandits.py b/axelrod/tests/strategies/test_armed_bandits.py index 48f07fd4c..b6cb5b054 100644 --- a/axelrod/tests/strategies/test_armed_bandits.py +++ b/axelrod/tests/strategies/test_armed_bandits.py @@ -89,35 +89,3 @@ def test_strategy(self): attrs={"_rewards": {C: 3, D: 0}}, seed=1, ) - - # temporary overriding function used to search for seeds - # def versus_test( - # self, - # opponent, - # expected_actions, - # turns=None, - # noise=None, - # seed=None, - # match_attributes=None, - # attrs=None, - # init_kwargs=None, - # ): - # - # if init_kwargs is None: - # init_kwargs = dict() - # - # player = self.player(**init_kwargs) - # - # test_match = TestMatch() - # seed = test_match.search_seeds( - # player, - # opponent, - # [x for (x, y) in expected_actions], - # [y for (x, y) in expected_actions], - # turns=turns, - # noise=noise, - # seed=seed, - # attrs=attrs, - # match_attributes=match_attributes, - # ) - # self.assertIsNotNone(seed) diff --git a/docs/index.rst b/docs/index.rst index f7fe5e0b0..0fc7c8ff3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -53,7 +53,7 @@ Count the number of available players:: >>> import axelrod as axl >>> len(axl.strategies) - 240 + 242 Create matches between two players:: diff --git a/docs/reference/strategy_index.rst b/docs/reference/strategy_index.rst index 103e01238..1eaf5d4ba 100644 --- a/docs/reference/strategy_index.rst +++ b/docs/reference/strategy_index.rst @@ -18,7 +18,7 @@ Here are the docstrings of all the strategies in the library. :members: .. automodule:: axelrod.strategies.appeaser :members: -.. automodule:: axelrod.strategies.armed_bandits +.. automodule:: axelrod.strategies.bandits :members: .. automodule:: axelrod.strategies.averagecopier :members: From ec568cce0aa61584c69809d6d5b6d757007eb491 Mon Sep 17 00:00:00 2001 From: YibingJ <144300516+bing-j@users.noreply.github.com> Date: Mon, 22 Apr 2024 15:41:21 -0400 Subject: [PATCH 13/13] modified test file to align with changes. all tests passed! --- axelrod/tests/strategies/test_armed_bandits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/axelrod/tests/strategies/test_armed_bandits.py b/axelrod/tests/strategies/test_armed_bandits.py index b6cb5b054..cd41425c8 100644 --- a/axelrod/tests/strategies/test_armed_bandits.py +++ b/axelrod/tests/strategies/test_armed_bandits.py @@ -9,7 +9,7 @@ class TestEpsilonGreedy(TestPlayer): - name = "$\varepsilon$-greedy: 0.1, 0.0, 0.0, inf" + name = "$\varepsilon$-greedy: 0.1, 0.0, 0.0, -1.0" player = axl.EpsilonGreedy expected_classifier = { "memory_depth": float("inf"),