1- """Tests for the Stalker strategy."""
1+ """Tests for the FrequencyAnalyzer strategy."""
22
33import axelrod as axl
44
77C , D = axl .Action .C , axl .Action .D
88
99
10- class TestStalker (TestPlayer ):
10+ class Test (TestPlayer ):
1111
12- name = "Stalker: (D,) "
13- player = axl .Stalker
12+ name = "FrequencyAnalyzer "
13+ player = axl .FreqAnalyzer
1414 expected_classifier = {
1515 "memory_depth" : float ("inf" ),
16- "stochastic" : True ,
17- "makes_use_of" : {"game" , "length" },
16+ "stochastic" : False ,
1817 "long_run_time" : False ,
1918 "inspects_source" : False ,
2019 "manipulates_source" : False ,
2120 "manipulates_state" : False ,
2221 }
2322
2423 def test_strategy (self ):
25- actions = [(C , C )] * 3 + [(D , C )]
26- self .versus_test (opponent = axl .Cooperator (), expected_actions = actions )
27-
28- # wish_score < current_average_score < very_good_score
29- actions = [(C , C )] * 7 + [(C , D ), (C , D ), (C , C ), (C , C ), (D , C )]
30- self .versus_test (
31- opponent = axl .MockPlayer (actions = [C ] * 7 + [D ] * 2 ),
32- expected_actions = actions ,
33- )
34-
35- actions = [(C , C )] * 7 + [(C , D ), (C , C ), (D , C )]
36- self .versus_test (
37- opponent = axl .MockPlayer (actions = [C ] * 7 + [D ]),
38- expected_actions = actions ,
39- )
40-
41- # current_average_score > 2
42- actions = [(C , C )] * 9 + [(D , C )]
43- self .versus_test (axl .Cooperator (), expected_actions = actions )
44-
45- # 1 < current_average_score < 2
46- actions = [(C , C )] * 7 + [(C , D )] * 4 + [(D , D )]
47- self .versus_test (
48- opponent = axl .MockPlayer (actions = [C ] * 7 + [D ] * 5 ),
49- expected_actions = actions ,
50- )
51-
52- def test_strategy2 (self ):
53- # current_average_score < 1
54- actions = (
55- [(C , D )]
56- + [(D , D )] * 2
57- + [(C , D )] * 3
58- + [(D , D ), (C , D ), (D , D ), (C , D ), (D , D ), (C , D ), (D , D )]
59- )
60- self .versus_test (axl .Defector (), expected_actions = actions , seed = 3222 )
61-
62- def test_strategy3 (self ):
63- actions = [(C , D )] * 3 + [
64- (D , D ),
65- (C , D ),
66- (D , D ),
67- (C , D ),
68- (C , D ),
69- (D , D ),
70- (C , D ),
71- (C , D ),
72- (C , D ),
73- (D , D ),
74- ]
75- self .versus_test (axl .Defector (), expected_actions = actions , seed = 649 )
76-
77- def test_strategy4 (self ):
78- # defect in last round
79- actions = [(C , C )] * 199 + [(D , C )]
80- self .versus_test (
81- axl .Cooperator (),
82- expected_actions = actions ,
83- match_attributes = {"length" : 200 },
84- )
85-
86- # Force a defection before the end of the actual match which ensures
87- # that current_average_score > very_good_score
88- actions = [(C , C )] * 3 + [(D , C )] * 3
89- self .versus_test (
90- opponent = axl .Cooperator (),
91- expected_actions = actions ,
92- match_attributes = {"length" : 4 },
93- )
24+ pass
0 commit comments