Exemplo n.º 1
0
 def test_scoring_with_alternate_game(self):
     """Tests that the alternate game is used in scoring."""
     player = axl.Adaptive()
     opponent = axl.Alternator()
     expected_actions = list(zip([C, C, C], [C, D, C]))
     attrs = {"scores": {C: 7, D: 0}}
     match_attributes = {"game": axl.Game(-3, 10, 10, 10)}
     self.versus_test(opponent, expected_actions, turns=3, attrs=attrs, seed=9,
                      match_attributes=match_attributes)
Exemplo n.º 2
0
 def test_scoring(self):
     player = axl.Adaptive()
     opponent = axl.Cooperator()
     player.play(opponent)
     player.play(opponent)
     self.assertEqual(3, player.scores[C])
     game = axl.Game(-3, 10, 10, 10)
     player.set_match_attributes(game=game)
     player.play(opponent)
     self.assertEqual(0, player.scores[C])
Exemplo n.º 3
0
 def test_rounds(self):
     self.versus_test(axelrod.Adaptive(), axelrod.TitForTat(),
                      [C] * 6 + [D] * 5 + [C, C],
                      [C] * 7 + [D] * 4 + [D, C])
Exemplo n.º 4
0
 def test_rounds(self):
     self.versus_test(axelrod.Adaptive(), axelrod.Alternator(),
                      [C] * 6 + [D] * 5 + [D] * 3, [C, D] * 7)
Exemplo n.º 5
0
 def test_rounds(self):
     self.versus_test(axelrod.Adaptive(), axelrod.Defector(),
                      [C] * 6 + [D] * 5 + [D] * 3, [D] * 14)