@@ -55,16 +55,20 @@ def test_strategy(self):
55
55
# D ten times and then continue to check for defections.
56
56
opponent = axl .Cooperator ()
57
57
actions = [(C , C )] * 20
58
- self .versus_test (opponent , expected_actions = actions )
58
+ attrs = {'grudged' : False , 'mem_length' : 10 , 'grudge_memory' : 0 }
59
+ self .versus_test (opponent , expected_actions = actions , attrs = attrs )
59
60
61
+ # grudge_memory goes to ten, resets and climbs back to five.
60
62
opponent = axl .Defector ()
61
- actions = [(C , D )] + [(D , D )] * 20
62
- self .versus_test (opponent , expected_actions = actions )
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 )
63
66
64
67
opponent_actions = [C ] * 2 + [D ] + [C ] * 10
65
68
opponent = axl .MockPlayer (actions = opponent_actions )
66
- expected = ([(C , C )] * 2 + [(C , D )] + [(D , C )] * 10 ) * 3
67
- self .versus_test (opponent , expected_actions = expected )
69
+ actions = ([(C , C )] * 2 + [(C , D )] + [(D , C )] * 10 ) * 3
70
+ attrs = {'grudged' : True , 'mem_length' : 10 , 'grudge_memory' : 10 }
71
+ self .versus_test (opponent , expected_actions = actions , attrs = attrs )
68
72
69
73
def test_reset_method (self ):
70
74
"""Tests the reset method."""
0 commit comments