@@ -979,10 +979,11 @@ def strategy(self, opponent: Player) -> Action:
979
979
980
980
class Harrington (Player ):
981
981
"""
982
- Strategy submitted to Axelrod's second tournament by Paul Harringtn (K75R),
982
+ Strategy submitted to Axelrod's second tournament by Paul Harrington (K75R)
983
983
and came in eighth in that tournament.
984
984
985
- This strategy has three modes: Normal, and Fair-weather, Defect.
985
+ This strategy has three modes: Normal, Fair-weather, and Defect. These
986
+ mode names were not present in Harrington's submission.
986
987
987
988
In Normal and Fair-weather modes, the strategy begins by:
988
989
@@ -1013,13 +1014,17 @@ class Harrington(Player):
1013
1014
The player mostly plays Tit-for-Tat for the first 36 moves, then defects on
1014
1015
the 37th move. If the opponent cooperates on the first 36 moves, and
1015
1016
defects on the 37th move also, then enter Fair-weather mode and cooperate
1016
- this turn.
1017
+ this turn. Entering Fair-weather mode is extremely rare, since this can
1018
+ only happen if the opponent cooperates for the first 36 then defects
1019
+ unprovoked on the 37th. (That is, this player's first 36 moves are also
1020
+ Cooperations, so there's nothing really to trigger an opponent Defection.)
1017
1021
1018
1022
Next in Normal Mode:
1019
1023
1020
1024
1. Check for defect and parity streaks.
1021
1025
2. Check if cooperations are scheduled.
1022
1026
3. Otherwise,
1027
+
1023
1028
- If turn < 37, Tit-for-Tat.
1024
1029
- If turn = 37, defect, mark this move as generous, and schedule two
1025
1030
more cooperations**.
@@ -1224,10 +1229,6 @@ def strategy(self, opponent: Player) -> Action:
1224
1229
1225
1230
if turn == 38 and opponent .history [- 1 ] == D and opponent .cooperations == 36 :
1226
1231
self .mode = "Fair-weather"
1227
- # These flags would already be set from turn == 37 logic below.
1228
- # Just take care to not lower this turn.
1229
- # self.more_coop = 2
1230
- # self.generous_n_turns_ago = 1 # 1 turn ago since this turn is ending.
1231
1232
return self .try_return (to_return = C , lower_flags = False )
1232
1233
1233
1234
@@ -1256,13 +1257,12 @@ def strategy(self, opponent: Player) -> Action:
1256
1257
1257
1258
if turn < 37 :
1258
1259
return self .try_return (opponent .history [- 1 ], inc_parity = True )
1259
- elif turn == 37 :
1260
+ if turn == 37 :
1260
1261
self .more_coop , self .generous_n_turns_ago = 2 , 1
1261
1262
return self .try_return (D , lower_flags = False )
1263
+ if self .burned or random .random () > self .prob :
1264
+ return self .try_return (opponent .history [- 1 ], inc_parity = True )
1262
1265
else :
1263
- if self .burned or random .random () > self .prob :
1264
- return self .try_return (opponent .history [- 1 ], inc_parity = True )
1265
- else :
1266
- self .prob += 0.05
1267
- self .more_coop , self .generous_n_turns_ago = 2 , 1
1268
- return self .try_return (D , lower_flags = False )
1266
+ self .prob += 0.05
1267
+ self .more_coop , self .generous_n_turns_ago = 2 , 1
1268
+ return self .try_return (D , lower_flags = False )
0 commit comments