Skip to content

Commit 4351ca0

Browse files
committed
closer to original TestForgetfulGrudger
1 parent 2ce541c commit 4351ca0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

axelrod/tests/strategies/test_grudger.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,17 @@ def test_strategy(self):
5858
attrs = {'grudged': False, 'mem_length': 10, 'grudge_memory': 0}
5959
self.versus_test(opponent, expected_actions=actions, attrs=attrs)
6060

61-
# grudge_memory goes to ten, resets and climbs back to five.
62-
opponent = axl.Defector()
63-
actions = [(C, D)] + [(D, D)] * 15
64-
attrs = {'grudged': True, 'mem_length': 10, 'grudge_memory': 5}
65-
self.versus_test(opponent, expected_actions=actions, attrs=attrs)
61+
for i in range(1, 15):
62+
opponent = axl.Defector()
63+
actions = [(C, D)] + [(D, D)] * i
64+
memory = i if i <= 10 else i - 10
65+
attrs = {'grudged': True, 'mem_length': 10, 'grudge_memory': memory}
66+
self.versus_test(opponent, expected_actions=actions, attrs=attrs)
6667

6768
opponent_actions = [C] * 2 + [D] + [C] * 10
6869
opponent = axl.MockPlayer(actions=opponent_actions)
69-
actions = ([(C, C)] * 2 + [(C, D)] + [(D, C)] * 10) * 3
70-
attrs = {'grudged': True, 'mem_length': 10, 'grudge_memory': 10}
70+
actions = ([(C, C)] * 2 + [(C, D)] + [(D, C)] * 10) * 3 + [(C, C)]
71+
attrs = {'grudged': False, 'mem_length': 10, 'grudge_memory': 0}
7172
self.versus_test(opponent, expected_actions=actions, attrs=attrs)
7273

7374
def test_reset_method(self):

0 commit comments

Comments
 (0)