コード例 #1
0
 def test_when_less_than_golder_ratio(self):
     """tests that if the ratio of Cs to Ds is less than the golden ratio then strategy co-operates"""
     P1 = axelrod.Golden()
     P2 = axelrod.Player()
     P1.history = ['C', 'C', 'C', 'C']
     P2.history = ['D', 'D', 'D', 'D']
     self.assertEqual(P1.strategy(P2), 'C')
コード例 #2
0
 def test_when_greater_than_golden_ratio(self):
     """tests that if the ratio of Cs to Ds is greater than the golden ratio then strategy defects"""
     P1 = axelrod.Golden()
     P2 = axelrod.Player()
     P1.history = ['C', 'C', 'C', 'C']
     P2.history = ['C', 'C', 'D', 'D']
     self.assertEqual(P1.strategy(P2), 'D')
コード例 #3
0
 def test_when_no_defection(self):
     """tests that if the opposing player does not defect initially then strategy defects"""
     P1 = axelrod.Golden()
     P2 = axelrod.Player()
     P1.history = ['C']
     P2.history = ['C']
     self.assertEqual(P1.strategy(P2), 'D')
コード例 #4
0
 def test_strategy(self):
     """test initial strategy co-operates"""
     P1 = axelrod.Golden()
     P2 = axelrod.Player()
     P2.history = []
     self.assertEqual(P1.strategy(P2), 'C')
コード例 #5
0
ファイル: test_golden.py プロジェクト: christianp/Axelrod
 def test_stochastic(self):
     self.assertFalse(axelrod.Golden().stochastic)
コード例 #6
0
ファイル: test_golden.py プロジェクト: christianp/Axelrod
 def test_representation(self):
     P1 = axelrod.Golden()
     self.assertEqual(str(P1), 'Golden')