@@ -73,6 +73,7 @@ def strategy(self, opponent: Player) -> Action:
73
73
return D
74
74
return C
75
75
76
+
76
77
class FirstByDowning (Player ):
77
78
"""
78
79
Submitted to Axelrod's first tournament by Downing
@@ -257,19 +258,20 @@ def strategy(self, opponent: Player) -> Action:
257
258
self .number_opponent_cooperations_in_response_to_C += 1
258
259
return D
259
260
260
-
261
261
if self .history [- 2 ] == C and opponent .history [- 1 ] == C :
262
262
self .number_opponent_cooperations_in_response_to_C += 1
263
263
if self .history [- 2 ] == D and opponent .history [- 1 ] == C :
264
264
self .number_opponent_cooperations_in_response_to_D += 1
265
265
266
+ # Adding 1 to cooperations for assumption that first opponent move
267
+ # being a response to a cooperation. See docstring for more
268
+ # information.
266
269
alpha = (self .number_opponent_cooperations_in_response_to_C /
267
- (self .cooperations + 1 )) # Adding 1 to count for assumption
268
- # that first opponent move being a
269
- # response to a cooperation. See
270
- # docstring for more information.
270
+ (self .cooperations + 1 ))
271
+ # Adding 2 to defections on the assumption that the first two
272
+ # moves are defections, which may not be true in a noisy match
271
273
beta = (self .number_opponent_cooperations_in_response_to_D /
272
- (self .defections ))
274
+ max (self .defections , 2 ))
273
275
274
276
R , P , S , T = self .match_attributes ["game" ].RPST ()
275
277
expected_value_of_cooperating = alpha * R + (1 - alpha ) * S
0 commit comments