def test_strategies_with_countermeasures_return_their_countermeasures(self): d_geller = axelrod.GellerDefector() inspector = axelrod.Cooperator() d_geller.play(inspector) self.assertEqual(inspect_strategy(inspector=inspector, opponent=d_geller), D) self.assertEqual(d_geller.strategy(inspector), C)
def test_returns_foil_inspection_strategy_of_opponent(self): self.versus_test(axelrod.GellerDefector(), expected_actions=[(D, C), (D, C), (D, C), (D, C)]) self.versus_test(axelrod.Darwin(), expected_actions=[(C, C), (C, C), (C, C)]) self.versus_test(axelrod.MindReader(), expected_actions=[(D, D), (D, D), (D, D)])
def test_strategies_with_countermeasures_return_their_countermeasures( self): d_geller = axl.GellerDefector() inspector = axl.Cooperator() match = axl.Match((d_geller, inspector), turns=1) match.play() self.assertEqual( inspect_strategy(inspector=inspector, opponent=d_geller), D) self.assertEqual(d_geller.strategy(inspector), C)
def test_returns_foil_inspection_strategy_of_opponent(self): seed = 2 # each Geller type returns the other's foil_inspection_strategy self.versus_test(axelrod.GellerDefector(), expected_actions=[(D, D), (D, D), (D, C), (D, C)], seed=seed) self.versus_test(axelrod.Darwin(), expected_actions=[(C, C), (C, C), (C, C)]) self.versus_test(axelrod.MindReader(), expected_actions=[(D, D), (D, C), (D, D)], seed=seed)
def test_stochastic(self): self.assertFalse(axelrod.GellerDefector().stochastic)