@@ -366,47 +366,74 @@ def test_strategy(self):
366366 # punishment co-players for his/her mistake
367367 opponent_actions = [C ] * 10 + [D ] + [C ] * 10
368368 opponent = axl .MockPlayer (actions = opponent_actions )
369- actions = [(C , C )] * 10 + [(C , D )] + [(D , C )] + [(C ,C )] * 9
369+ actions = [(C , C )] * 10 + [(C , D )] + [(D , C )] + [(C , C )] * 9
370370 self .versus_test (opponent , expected_actions = actions )
371371
372372 # never allow the defection more than once
373373 opponent_actions = [C ] * 10 + [D ] * 2 + [C ] * 10
374374 opponent = axl .MockPlayer (actions = opponent_actions )
375- actions = [(C , C )] * 10 + [(C , D )] + [(D , D )] + [(D ,C )] * 9
375+ actions = [(C , C )] * 10 + [(C , D )] + [(D , D )] + [(D , C )] * 9
376376 self .versus_test (opponent , expected_actions = actions )
377377
378378 def test_noisy_actions (self ):
379379 # accept punishment when making a mistake
380- actions1 = [C ,C , D , C , C , C , C ]
381- actions2 = [C ,C , C , D , C , C , C ]
380+ actions1 = [C , C , D , C , C , C , C ]
381+ actions2 = [C , C , C , D , C , C , C ]
382382 opponent = axl .MockPlayer (actions = actions2 )
383- self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 20 )
383+ self .versus_test (
384+ opponent ,
385+ expected_actions = list (zip (actions1 , actions2 )),
386+ noise = 0.1 ,
387+ seed = 20 ,
388+ )
384389
385390 # recover the cooperation when the opponent cooperated from mutual defection
386- actions1 = [C ,D , D , D , D , C , C , C ]
387- actions2 = [D ,D , D , D , C , C , C , C ]
391+ actions1 = [C , D , D , D , D , C , C , C ]
392+ actions2 = [D , D , D , D , C , C , C , C ]
388393 opponent = axl .MockPlayer (actions = actions2 )
389- self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0 )
394+ self .versus_test (
395+ opponent , expected_actions = list (zip (actions1 , actions2 )), noise = 0
396+ )
390397
391398 # recover the cooperation when the player cooperated by mistake from mutual defection
392- actions1 = [C ,D , D , D , C , C , C , C ]
393- actions2 = [D ,D , D , D , D , C , C , C ]
399+ actions1 = [C , D , D , D , C , C , C , C ]
400+ actions2 = [D , D , D , D , D , C , C , C ]
394401 opponent = axl .MockPlayer (actions = actions2 )
395- self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 72 )
402+ self .versus_test (
403+ opponent ,
404+ expected_actions = list (zip (actions1 , actions2 )),
405+ noise = 0.1 ,
406+ seed = 72 ,
407+ )
396408
397409 # recover the cooperation when the focal and the opponent player cooperated by mistake from mutual defection
398- actions1 = [C ,D , D , D , C , C , C , C ]
399- actions2 = [D ,D , D , D , C , C , C , C ]
410+ actions1 = [C , D , D , D , C , C , C , C ]
411+ actions2 = [D , D , D , D , C , C , C , C ]
400412 opponent = axl .MockPlayer (actions = actions2 )
401- self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 72 )
413+ self .versus_test (
414+ opponent ,
415+ expected_actions = list (zip (actions1 , actions2 )),
416+ noise = 0.1 ,
417+ seed = 72 ,
418+ )
402419
403420 # in other cases, defect
404- actions1 = [C ,D , C , C , D , D , D , D ]
405- actions2 = [D ,D , D , D , D , C , C , D ]
421+ actions1 = [C , D , C , C , D , D , D , D ]
422+ actions2 = [D , D , D , D , D , C , C , D ]
406423 opponent = axl .MockPlayer (actions = actions2 )
407- self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 452 )
424+ self .versus_test (
425+ opponent ,
426+ expected_actions = list (zip (actions1 , actions2 )),
427+ noise = 0.1 ,
428+ seed = 452 ,
429+ )
408430
409- actions1 = [C ,D , C , D ]
410- actions2 = [C ,C , C , D ]
431+ actions1 = [C , D , C , D ]
432+ actions2 = [C , C , C , D ]
411433 opponent = axl .MockPlayer (actions = actions2 )
412- self .versus_test (opponent , expected_actions = list (zip (actions1 ,actions2 )), noise = 0.1 , seed = 15 )
434+ self .versus_test (
435+ opponent ,
436+ expected_actions = list (zip (actions1 , actions2 )),
437+ noise = 0.1 ,
438+ seed = 15 ,
439+ )
0 commit comments