@@ -250,25 +250,37 @@ def strategy(self, opponent: Player) -> Action:
250
250
return random_choice (p )
251
251
252
252
253
- class Graaskamp (Player ):
253
+ class FirstByGraaskamp (Player ):
254
254
"""
255
+ Submitted to Axelrod's first tournament by James Graaskamp..
255
256
256
- This is one of the strategies from Robert Axelrod's first tournament and is
257
- described in the literature as:
257
+ The description written in [Axelrod1980]_ is:
258
+
259
+ > "This rule plays tit for tat for 50 moves, defects on move 51, and then
260
+ > plays 5 more moves of tit for tat. A check is then made to see if the player
261
+ > seems to be RANDOM, in which case it defects from then on. A check is also
262
+ > made to see if the other is TIT FOR TAT, ANALOGY (a program from the
263
+ > preliminary tournament), and its own twin, in which case it plays tit for
264
+ > tat. Otherwise it randomly defects every 5 to 15 moves, hoping that enough
265
+ > trust has been built up so that the other player will not notice these
266
+ > defections.:
267
+
268
+ This is implemented as:
258
269
259
270
1. Plays Tit For Tat for the first 50 rounds;
260
271
2. Defects on round 51;
261
272
3. Plays 5 further rounds of Tit For Tat;
262
273
4. A check is then made to see if the opponent is playing randomly in which
263
- case it defects for the rest of the game;
274
+ case it defects for the rest of the game, this is implemented with a chi
275
+ squared test.
264
276
5. The strategy also checks to see if the opponent is playing Tit For Tat or
265
- another strategy from a preliminary tournament called ‘Analogy’ If
277
+ a clone of itself. If
266
278
so it plays Tit For Tat. If not it cooperates and randomly defects every 5
267
279
to 15 moves.
268
280
269
281
270
282
Note that there is no information about 'Analogy' available thus Step 5 is
271
- not implemented fully .
283
+ a "best possible" interpretation of the description in the paper .
272
284
273
285
This strategy came 9th in Axelrod’s original tournament.
274
286
@@ -277,7 +289,7 @@ class Graaskamp(Player):
277
289
- Graaskamp: [Axelrod1980]_
278
290
"""
279
291
280
- name = "Graaskamp"
292
+ name = "First tournament by Graaskamp"
281
293
classifier = {
282
294
"memory_depth" : float ("inf" ),
283
295
"stochastic" : True ,
@@ -321,8 +333,8 @@ def strategy(self, opponent: Player) -> Action:
321
333
if all (
322
334
opponent .history [i ] == self .history [i - 1 ]
323
335
for i in range (1 , len (self .history ))
324
- ):
325
- # Check if opponent plays Tit for Tat
336
+ ) or opponent . history == self . history :
337
+ # Check if opponent plays Tit for Tat or a clone of itself.
326
338
if opponent .history [- 1 ] == D :
327
339
return D
328
340
return C
0 commit comments