@@ -382,25 +382,38 @@ def test_strategy(self):
382
382
actions = [(C , C )] * 10 + [(C , D )] + [(D , D )] + [(D ,C )] * 9
383
383
self .versus_test (opponent , expected_actions = actions )
384
384
385
- def test_prescriptions (self ):
385
+ def test_noisy_actions (self ):
386
386
# accept punishment when making a mistake
387
- self .assert_prescription ([C ,C ,D ], [C ,C ,C ], C )
388
- self .assert_prescription ([C ,D ,C ], [C ,C ,D ], C )
389
- self .assert_prescription ([D ,C ,C ], [C ,D ,C ], C )
390
- self .assert_prescription ([C ,C ,C ], [D ,C ,C ], C )
391
-
392
- # recover the cooperation from mutual defection
393
- self .assert_prescription ([D ,D ,C ], [D ,D ,D ], C )
394
- self .assert_prescription ([D ,C ,C ], [D ,D ,C ], C )
395
- self .assert_prescription ([C ,C ,C ], [D ,C ,C ], C )
396
-
397
- self .assert_prescription ([D ,D ,D ], [D ,D ,C ], C )
398
- self .assert_prescription ([D ,D ,C ], [D ,C ,C ], C )
399
- self .assert_prescription ([D ,C ,C ], [C ,C ,C ], C )
400
-
401
- self .assert_prescription ([D ,D ,C ], [D ,D ,C ], C )
402
- self .assert_prescription ([D ,C ,C ], [D ,C ,C ], C )
387
+ actions1 = [C ,C ,D ,C ,C ,C ,C ]
388
+ actions2 = [C ,C ,C ,D ,C ,C ,C ]
389
+ opponent = axl .MockPlayer (actions = actions2 )
390
+ self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 20 )
391
+
392
+ # recover the cooperation when the opponent cooperated from mutual defection
393
+ actions1 = [C ,D ,D ,D ,D ,C ,C ,C ]
394
+ actions2 = [D ,D ,D ,D ,C ,C ,C ,C ]
395
+ opponent = axl .MockPlayer (actions = actions2 )
396
+ self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0 )
397
+
398
+ # recover the cooperation when the player cooperated by mistake from mutual defection
399
+ actions1 = [C ,D ,D ,D ,C ,C ,C ,C ]
400
+ actions2 = [D ,D ,D ,D ,D ,C ,C ,C ]
401
+ opponent = axl .MockPlayer (actions = actions2 )
402
+ self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 72 )
403
+
404
+ # recover the cooperation when the focal and the opponent player cooperated by mistake from mutual defection
405
+ actions1 = [C ,D ,D ,D ,C ,C ,C ,C ]
406
+ actions2 = [D ,D ,D ,D ,C ,C ,C ,C ]
407
+ opponent = axl .MockPlayer (actions = actions2 )
408
+ self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 72 )
403
409
404
410
# in other cases, defect
405
- self .assert_prescription ([D ,C ,C ], [D ,D ,D ], D )
406
- self .assert_prescription ([C ,D ,C ], [C ,C ,C ], D )
411
+ actions1 = [C ,D ,C ,C ,D ,D ,D ,D ]
412
+ actions2 = [D ,D ,D ,D ,D ,C ,C ,D ]
413
+ opponent = axl .MockPlayer (actions = actions2 )
414
+ self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 452 )
415
+
416
+ actions1 = [C ,D ,C ,D ]
417
+ actions2 = [C ,C ,C ,D ]
418
+ opponent = axl .MockPlayer (actions = actions2 )
419
+ self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 15 )
0 commit comments