@@ -512,6 +512,72 @@ def test_strategy(self):
512512 self .transitions_test (state_and_actions )
513513
514514
515+ class TestUsuallyCooperates (TestFSMPlayer ):
516+ name = "UsuallyCooperates"
517+ player = axelrod .UsuallyCooperates
518+ expected_classifier = {
519+ "memory_depth" : 2 ,
520+ "stochastic" : False ,
521+ "makes_use_of" : set (),
522+ "long_run_time" : False ,
523+ "inspects_source" : False ,
524+ "manipulates_source" : False ,
525+ "manipulates_state" : False ,
526+ }
527+ """
528+ transitions = (
529+ (1, C, 1, C),
530+ (1, D, 2, C),
531+ (2, C, 1, D),
532+ (2, D, 1, C)
533+ )
534+ """
535+
536+ def test_strategy (self ):
537+ # Never leaves state 1 if C
538+ state_and_actions = [(1 , C )] * 10
539+ self .transitions_test (state_and_actions )
540+ # Visits state 2, but then comes back
541+ # Defaults if DC streak is complete. Starts streak over either way.
542+ state_and_actions = [(1 , D ), (2 , D )]
543+ self .transitions_test (state_and_actions )
544+ state_and_actions = [(1 , D ), (2 , C )]
545+ self .transitions_test (state_and_actions )
546+
547+
548+ class TestUsuallyDefects (TestFSMPlayer ):
549+ name = "UsuallyDefects"
550+ player = axelrod .UsuallyDefects
551+ expected_classifier = {
552+ "memory_depth" : 2 ,
553+ "stochastic" : False ,
554+ "makes_use_of" : set (),
555+ "long_run_time" : False ,
556+ "inspects_source" : False ,
557+ "manipulates_source" : False ,
558+ "manipulates_state" : False ,
559+ }
560+ """
561+ transitions = (
562+ (1, C, 2, D),
563+ (1, D, 1, D),
564+ (2, C, 1, D),
565+ (2, D, 1, C)
566+ )
567+ """
568+
569+ def test_strategy (self ):
570+ # Never leaves state 1 if D
571+ state_and_actions = [(1 , D )] * 10
572+ self .transitions_test (state_and_actions )
573+ # Visits state 2, but then comes back
574+ # Cooperates if CD streak is complete. Starts streak over either way.
575+ state_and_actions = [(1 , C ), (2 , D )]
576+ self .transitions_test (state_and_actions )
577+ state_and_actions = [(1 , C ), (2 , C )]
578+ self .transitions_test (state_and_actions )
579+
580+
515581class TestSolutionB1 (TestFSMPlayer ):
516582
517583 name = "SolutionB1"
0 commit comments