diff --git a/axelrod/strategies/axelrod_first.py b/axelrod/strategies/axelrod_first.py index 0ea5d9929..d4996e1f8 100644 --- a/axelrod/strategies/axelrod_first.py +++ b/axelrod/strategies/axelrod_first.py @@ -581,7 +581,7 @@ def strategy(self, opponent: Player) -> Action: self.opponent_is_random = p_value >= self.alpha if self.opponent_is_random: - # MyCooperator if opponent plays randomly + # Defect if opponent plays randomly return D else: # TitForTat if opponent plays not randomly return opponent.history[-1] diff --git a/axelrod/strategies/axelrod_second.py b/axelrod/strategies/axelrod_second.py index 7b921cc11..485451957 100644 --- a/axelrod/strategies/axelrod_second.py +++ b/axelrod/strategies/axelrod_second.py @@ -128,7 +128,7 @@ def __init__(self) -> None: self.is_TFT = False def strategy(self, opponent: Player) -> Action: - # MyCooperator on the first move + # Defect on the first move if not opponent.history: return D # Am I TFT? diff --git a/axelrod/strategies/cooperator.py b/axelrod/strategies/cooperator.py index 53c2f54e2..e4a3f8b23 100644 --- a/axelrod/strategies/cooperator.py +++ b/axelrod/strategies/cooperator.py @@ -56,8 +56,8 @@ class TrickyCooperator(Player): def strategy(self, opponent: Player) -> Action: """Almost always cooperates, but will try to trick the opponent by defecting. - MyCooperator once in a while in order to get a better payout. - After 3 rounds, if opponent has not defected to a max history depth of 10, MyCooperator. + Defect once in a while in order to get a better payout. + After 3 rounds, if opponent has not defected to a max history depth of 10, Defect. """ if (self._has_played_enough_rounds_to_be_tricky() and self._opponents_has_cooperated_enough_to_be_tricky(opponent)): diff --git a/axelrod/strategies/defector.py b/axelrod/strategies/defector.py index 9f4a762c9..b3a85d1b8 100644 --- a/axelrod/strategies/defector.py +++ b/axelrod/strategies/defector.py @@ -53,7 +53,7 @@ def strategy(self, opponent: Player) -> Action: """Almost always defects, but will try to trick the opponent into cooperating. - MyCooperator if opponent has cooperated at least once in the past and has + Defect if opponent has cooperated at least once in the past and has defected for the last 3 turns in a row. """ if C in opponent.history and opponent.history[-3:] == [D] * 3: diff --git a/axelrod/strategies/gobymajority.py b/axelrod/strategies/gobymajority.py index f828b25b4..6a502c92e 100644 --- a/axelrod/strategies/gobymajority.py +++ b/axelrod/strategies/gobymajority.py @@ -155,7 +155,7 @@ def __init__(self) -> None: class HardGoByMajority(GoByMajority): """A player examines the history of the opponent: if the opponent has more defections than cooperations then the player defects. In case of equal - number of defections and cooperations this player will MyCooperator. + number of defections and cooperations this player will Defect. An optional memory attribute will limit the number of turns remembered (by default this is 0) diff --git a/axelrod/strategies/titfortat.py b/axelrod/strategies/titfortat.py index 4869a4376..96ec88727 100644 --- a/axelrod/strategies/titfortat.py +++ b/axelrod/strategies/titfortat.py @@ -364,7 +364,7 @@ def strategy(self, opponent: Player) -> Action: if self.history[-1] != opponent.history[-1]: self.randomness_counter += 1 # Compare counts to thresholds - # If randomness_counter exceeds Y, MyCooperator for the remainder + # If randomness_counter exceeds Y, Defect for the remainder if self.randomness_counter >= self.randomness_threshold: move = D else: @@ -683,7 +683,7 @@ def strategy(self, opponent: Player) -> Action: class EugineNier(Player): """ Plays similar to Tit-for-Tat, but with two conditions: - 1) Always MyCooperator on Last Move + 1) Always Defect on Last Move 2) If other player defects five times, switch to all defects. Names: diff --git a/axelrod/tests/strategies/test_axelrod_first.py b/axelrod/tests/strategies/test_axelrod_first.py index 0321a49b1..bed9dfb79 100644 --- a/axelrod/tests/strategies/test_axelrod_first.py +++ b/axelrod/tests/strategies/test_axelrod_first.py @@ -417,7 +417,7 @@ def test_strategy(self): # On 15th round carry out chi-square test. actions += [(D, C), (C, D)] * 5 + [(D, C)] - # MyCooperator throughout. + # Defect throughout. actions += [(D, D), (D, C), (D, D), (D, C)] self.versus_test(opponent, expected_actions=actions, @@ -431,7 +431,7 @@ def test_strategy(self): actions = [(C, C), (C, D), (C, C), (C, D)] # On 15th round carry out chi-square test. actions += [(D, C), (C, D)] * 4 + [(D, C), (C, C), (D, C)] - # MyCooperator throughout and carry out chi-square test on round 30. + # Defect throughout and carry out chi-square test on round 30. # Opponent is no longer recognised as random, revert to TFT. actions += [(D, C)] * 14 + [(C, C)] self.versus_test(opponent, expected_actions=actions, diff --git a/axelrod/tests/strategies/test_dbs.py b/axelrod/tests/strategies/test_dbs.py index 7fcbf01ce..d710a53af 100644 --- a/axelrod/tests/strategies/test_dbs.py +++ b/axelrod/tests/strategies/test_dbs.py @@ -45,7 +45,7 @@ def setUp(self): def test_minimaxTreeSearch_cooperator(self): """ Tests the minimax_tree_search function when playing against a - Cooperator player. Output == 0 means Cooperate, 1 means MyCooperator. + Cooperator player. Output == 0 means Cooperate, 1 means Defect. The best (hence expected) answer to Cooperator is to defect whatever the input position is. """ diff --git a/axelrod/tests/strategies/test_retaliate.py b/axelrod/tests/strategies/test_retaliate.py index d8d1760cc..83c00704d 100644 --- a/axelrod/tests/strategies/test_retaliate.py +++ b/axelrod/tests/strategies/test_retaliate.py @@ -114,7 +114,7 @@ def test_strategy(self): attrs={"retaliation_count": 0}, init_kwargs={"retaliation_limit": 2}) - # MyCooperator again after cooperating + # Defect again after cooperating actions = [(C, C), (C, D), (D, C), (D, D), (C, C), (D, D), (D, C)] self.versus_test(opponent=opponent, expected_actions=actions, attrs={"retaliation_count": 2}, diff --git a/axelrod/tests/strategies/test_shortmem.py b/axelrod/tests/strategies/test_shortmem.py index 20dd9aa46..b1a61ed09 100644 --- a/axelrod/tests/strategies/test_shortmem.py +++ b/axelrod/tests/strategies/test_shortmem.py @@ -31,7 +31,7 @@ def test_strategy(self): actions = [(C, C)] * 11 + [(C, D)] * 4 self.versus_test(opponent=axelrod.MockPlayer(actions=[C] * 11 + [D] * 4), expected_actions=actions) - #MyCooperator if in the last ten moves, Defections - Cooperations >= 3 + #Defect if in the last ten moves, Defections - Cooperations >= 3 actions = [(C, D)] * 11 + [(D, C)] * 4 self.versus_test(opponent=axelrod.MockPlayer(actions=[D] * 11 + [C] * 4), expected_actions=actions) diff --git a/axelrod/tests/strategies/test_worse_and_worse.py b/axelrod/tests/strategies/test_worse_and_worse.py index 7c6fc2d1e..6d178cd0c 100644 --- a/axelrod/tests/strategies/test_worse_and_worse.py +++ b/axelrod/tests/strategies/test_worse_and_worse.py @@ -26,7 +26,7 @@ def test_strategy(self): self.versus_test(axelrod.Cooperator(), expected_actions = actions, seed=8) - # 6 Rounds Cooperate and MyCooperator no matter oponent + # 6 Rounds Cooperate and Defect no matter oponent actions = [(C, D)] * 6 + [(D, D)] + [(C, D)] * 3 self.versus_test(axelrod.Defector(), expected_actions = actions, seed=8) diff --git a/axelrod/tests/unit/test_game.py b/axelrod/tests/unit/test_game.py index 88d4c287b..523288133 100644 --- a/axelrod/tests/unit/test_game.py +++ b/axelrod/tests/unit/test_game.py @@ -29,6 +29,18 @@ def test_score(self): self.assertEqual(self.game.score((C, D)), (0, 5)) self.assertEqual(self.game.score((D, C)), (5, 0)) + def test_equality(self): + game_1 = Game(1, 2, 3, 4) + game_2 = Game(1, 2, 3, 4) + not_equal = Game() + + self.assertEqual(game_1, game_2) + self.assertNotEqual(not_equal, game_1) + + self.assertEqual(Game(), Game()) + + self.assertNotEqual(Game(), 'wrong class') + @given(r=integers(), p=integers(), s=integers(), t=integers()) def test_property_init(self, r, p, s, t): """Use the hypothesis library to test init""" diff --git a/docs/reference/description.rst b/docs/reference/description.rst index a4653092d..50f793f1f 100644 --- a/docs/reference/description.rst +++ b/docs/reference/description.rst @@ -11,11 +11,11 @@ The Prisoner's Dilemma The `Prisoner's dilemma `_ is the simple two player game shown below: +----------+---------------+---------------+ -| | Cooperate | MyCooperator | +| | Cooperate | Defect | +==========+===============+===============+ |Cooperate | (3,3) | (0,5) | +----------+---------------+---------------+ -|MyCooperator | (5,0) | (1,1) | +|Defect | (5,0) | (1,1) | +----------+---------------+---------------+ If both players cooperate they will each go to prison for 2 years and receive an diff --git a/docs/reference/play_contexts.rst b/docs/reference/play_contexts.rst index 640e22499..67888e747 100644 --- a/docs/reference/play_contexts.rst +++ b/docs/reference/play_contexts.rst @@ -14,11 +14,11 @@ generic Prisoner's dilemma: +----------+---------------+---------------+ -| | Cooperate | MyCooperator | +| | Cooperate | Defect | +==========+===============+===============+ |Cooperate | (R,R) | (S,T) | +----------+---------------+---------------+ -|MyCooperator | (T,S) | (P,P) | +|Defect | (T,S) | (P,P) | +----------+---------------+---------------+ For the above to constitute a Prisoner's dilemma, the following must hold: diff --git a/omfg.png b/omfg.png deleted file mode 100644 index 35c1193f3..000000000 Binary files a/omfg.png and /dev/null differ