diff --git a/axelrod/strategies/meta.py b/axelrod/strategies/meta.py index 04842e7e2..df8d25962 100644 --- a/axelrod/strategies/meta.py +++ b/axelrod/strategies/meta.py @@ -235,11 +235,12 @@ class MetaHunterAggressive(MetaPlayer): 'manipulates_state': False } - def __init__(self): + def __init__(self, team=None): # This version uses CooperatorHunter - team = [DefectorHunter, AlternatorHunter, RandomHunter, - MathConstantHunter, CycleHunter, EventualCycleHunter, - CooperatorHunter] + if team is None: + team = [DefectorHunter, AlternatorHunter, RandomHunter, + MathConstantHunter, CycleHunter, EventualCycleHunter, + CooperatorHunter] super().__init__(team=team) diff --git a/axelrod/tests/strategies/test_meta.py b/axelrod/tests/strategies/test_meta.py index 065c3e71c..21cc83b92 100644 --- a/axelrod/tests/strategies/test_meta.py +++ b/axelrod/tests/strategies/test_meta.py @@ -247,9 +247,6 @@ def test_strategy(self): # defection self.responses_test([D], [C, C, C, C], [C, C, C, C]) - # After long histories tit-for-tat should come into play. - self.responses_test([D], [C] * 101, [C] * 100 + [D]) - # All these others, however, should trigger a defection for the hunter. self.responses_test([D], [C] * 4, [D] * 4) self.responses_test([D], [C] * 6, [C, D] * 3) @@ -258,6 +255,23 @@ def test_strategy(self): self.responses_test([D], [C] * 101, [C] * 101) self.responses_test([D], [C] * 101, [C] * 100 + [D]) + # To test the TFT action of the strategy after 100 turns, we need to + # remove two of the hunters from its team. + # It is almost impossible to identify a history which reaches 100 turns + # without triggering one of the hunters in the default team. As at + # 16-Mar-2017, none of the strategies in the library does so. + team = [ + axelrod.DefectorHunter, + axelrod.AlternatorHunter, + axelrod.RandomHunter, + # axelrod.MathConstantHunter, + axelrod.CycleHunter, + axelrod.EventualCycleHunter, + # axelrod.CooperatorHunter + ] + self.responses_test( + [D], [C] * 101, [C] * 100 + [D], init_kwargs={'team': team}) + class TestMetaMajorityMemoryOne(TestMetaPlayer): name = "Meta Majority Memory One"