|
| 1 | +"""Test for the Resurrection strategy.""" |
| 2 | + |
| 3 | +import axelrod |
| 4 | +from .test_player import TestPlayer |
| 5 | + |
| 6 | +C, D = axelrod.Actions.C, axelrod.Actions.D |
| 7 | +class Resurrection(TestPlayer): |
| 8 | + |
| 9 | + name = "Resurrection" |
| 10 | + player = axelrod.Resurrection |
| 11 | + expected_classifier = { |
| 12 | + 'memory_depth': 1, |
| 13 | + 'stochastic': False, |
| 14 | + 'makes_use_of': set(), |
| 15 | + 'long_run_time': False, |
| 16 | + 'inspects_source': False, |
| 17 | + 'manipulates_source': False, |
| 18 | + 'manipulates_state': False |
| 19 | + } |
| 20 | + |
| 21 | + def test_strategy(self): |
| 22 | + # Starts by Cooperating |
| 23 | + self.first_play_test(C) |
| 24 | + |
| 25 | + # Check if the turns played are greater than 5 |
| 26 | + self.responses_test([D], [D, C, C, D, D, D, D, D] , [C] * 8) |
| 27 | + |
| 28 | + #Check if turns played are less than 5. |
| 29 | + self.responses_test([C], [D, C, D, C], [C] * 4) |
| 30 | + |
| 31 | + # Check for TFT behavior after 5 rounds |
| 32 | + self.responses_test([C], [C] * 5, [C, C, C, C, C, D]) |
| 33 | + |
| 34 | + # Check for four defections and a cooperation by opponent |
| 35 | + self.responses_test([D], [C] * 5, [D, D, D, D, D, C]) |
0 commit comments