|
| 1 | +import axelrod |
| 2 | +from test_player import TestPlayer |
| 3 | + |
| 4 | +C, D = axelrod.Action.C, axelrod.Action.D |
| 5 | + |
| 6 | +class TestAdaptiveCooperator(TestPlayer): |
| 7 | + name = 'Adaptive Cooperator' |
| 8 | + player = axelrod.AdaptiveCooperator |
| 9 | + expected_classifier = { |
| 10 | + 'memory': 1, |
| 11 | + 'stochastic': False, |
| 12 | + 'inspects_source': False, |
| 13 | + 'manipulates_source': False, |
| 14 | + 'manipulates_state': False |
| 15 | + } |
| 16 | + |
| 17 | + def test_first__strategy(self): |
| 18 | + self.first_play_test(C) |
| 19 | + |
| 20 | + def test_strategy_cooperator(self): |
| 21 | + actions = [(C, C), (C, C), (C, C), (C, C), (C, C)] |
| 22 | + self.versus_test(axelrod.Cooperator(), expected_actions=actions) |
| 23 | + |
| 24 | + def test_strategy_defector(self): |
| 25 | + actions = [(C, D), (D, D), (D, D), (D, D), (D, D)] |
| 26 | + self.versus_test(axelrod.Defector(), expected_actions=actions) |
| 27 | + |
| 28 | + def test_strategy_alternator(self): |
| 29 | + actions = [(C, C), (C, D), (D, C), (D, D), (D, C)] |
| 30 | + self.versus_test(axelrod.Alternator(), expected_actions=actions) |
| 31 | + |
0 commit comments