@@ -104,8 +104,8 @@ class TestProber4(TestPlayer):
104
104
name = "Prober 4"
105
105
player = axelrod .Prober4
106
106
expected_classifier = {
107
- 'memory_depth' : 1 ,
108
107
'stochastic' : False ,
108
+ 'memory_depth' : 1 ,
109
109
'makes_use_of' : set (),
110
110
'long_run_time' : False ,
111
111
'inspects_source' : False ,
@@ -114,24 +114,54 @@ class TestProber4(TestPlayer):
114
114
}
115
115
initial_sequence = [C , C , D , C , D , D , D , C , C , D ,
116
116
C , D , C , C , D , C , D , D , C , D ]
117
+ cooperation_pool = [C ] * 5
117
118
118
119
def test_initial_strategy (self ):
119
120
"""Starts by playing CCDCDDDCCDCDCCDCDDCD."""
120
121
self .responses_test ([], [], self .initial_sequence )
121
122
122
123
def test_strategy (self ):
123
- # Defects forever if opponent played D for C
124
- # at least 3 more times than D for D
125
- self .responses_test (self .initial_sequence ,
126
- self .initial_sequence , [D ] * 10 )
127
-
128
- # Defects forever if opponent played D for D
129
- # at least 3 more times than C for D
130
- opponents_history = list (map (lambda x : D if x is C else C ,
131
- self .initial_sequence ))
132
-
133
- self .responses_test (self .initial_sequence ,
134
- opponents_history , [D ] * 10 )
124
+ # Defects forever if the opponent played D for C
125
+ # at least 3 times more than D for D
126
+ history1 = self .initial_sequence
127
+ history2 = self .initial_sequence
128
+ responses = [D ] * 10
129
+ self .responses_test (history1 , history2 , responses )
130
+
131
+ # or if the opponent played D for D
132
+ # at least 3 times more than D for C
133
+ history1 = self .initial_sequence
134
+ history2 = list (map (lambda x : D if x is C else C ,
135
+ self .initial_sequence ))
136
+ responses = [D ] * 10
137
+ self .responses_test (history1 , history2 , responses )
138
+
139
+ # Otherwise cooperates for 5 rounds
140
+ history1 = self .initial_sequence
141
+ history2 = [C ] * len (history1 )
142
+ responses = self .cooperation_pool
143
+ self .responses_test (history1 , history2 , responses )
144
+
145
+ # and plays like TFT afterwards
146
+ history1 = self .initial_sequence + self .cooperation_pool
147
+ history2 = [C ] * (len (history1 ) - 1 ) + [D ]
148
+ self .responses_test (history1 , history2 , [D ])
149
+
150
+ history1 = self .initial_sequence + self .cooperation_pool + [D ]
151
+ history2 = [C ] * len (history1 )
152
+ self .responses_test (history1 , history2 , [C ])
153
+
154
+ history1 = self .initial_sequence + self .cooperation_pool
155
+ history2 = [C ] * len (history1 )
156
+ self .responses_test (history1 , history2 , [C ])
157
+
158
+ history1 = self .initial_sequence + self .cooperation_pool + [C ]
159
+ history2 = [C ] * (len (history1 ) - 1 ) + [D ]
160
+ self .responses_test (history1 , history2 , [D ])
161
+
162
+ history1 = self .initial_sequence + self .cooperation_pool + [C ]
163
+ history2 = [C ] * (len (history1 ) - 1 ) + [D ]
164
+ self .responses_test (history1 , history2 , [D ])
135
165
136
166
137
167
class TestHardProber (TestPlayer ):
0 commit comments