Skip to content

Commit

Permalink
Use defector and cooperator for test_selfsteem
Browse files Browse the repository at this point in the history
  • Loading branch information
drvinceknight authored and marcharper committed Jul 30, 2017
1 parent 8a0f83c commit 2d0e2c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions axelrod/tests/strategies/test_selfsteem.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,31 @@ def test_strategy(self):
# Check for f < -0.95, cooperate
actions = [(D, C), (C, C), (D, C), (D, C),
(C, C), (D, C), (C, C), (C, C)]
self.versus_test(opponent=axelrod.MockPlayer(actions=[C]),
self.versus_test(opponent=axelrod.Cooperator(),
expected_actions=actions, seed=0)

actions = [(D, D)] + [(D, D)] * 5 + [(D, D), (C, D), (C, D)]
self.versus_test(opponent=axelrod.MockPlayer(actions=[D]),
self.versus_test(opponent=axelrod.Defector(),
expected_actions=actions, seed=0)

# Check for -0.3 < f < 0.3, random
actions = [(D, C), (C, C), (D, C), (D, C),
(C, C), (D, C)] + [(C, C)] * 6 + [(D, C),(D, C)] + [(C, C)] * 7
self.versus_test(opponent=axelrod.MockPlayer(actions=[C]),
self.versus_test(opponent=axelrod.Cooperator(),
expected_actions=actions, seed=6)

actions = [(D, D)] * 7 + [(C, D), (C, D)] + [(D, D)] * 8 + [(C, D),
(C, D), (D, D), (D, D), (D, D)]
self.versus_test(opponent=axelrod.MockPlayer(actions=[D]),
self.versus_test(opponent=axelrod.Defector(),
expected_actions=actions, seed=5)

# Check for 0.95 > abs(f) > 0.3, follows TitForTat
actions = [(D, D)] * 5 + [(C, D), (D, D), (C, D),
(C, D), (D, D), (C, D)] + [(D, D)] * 5
self.versus_test(opponent=axelrod.MockPlayer(actions=[D]),
self.versus_test(opponent=axelrod.Defector(),
expected_actions=actions)

actions = [(D, C), (C, C), (D, C), (D, C),
(C, C), (D, C), (C, C), (C, C), (C, C), (C, C)]
self.versus_test(opponent=axelrod.MockPlayer(actions=[C]),
self.versus_test(opponent=axelrod.Cooperator(),
expected_actions=actions)

0 comments on commit 2d0e2c6

Please sign in to comment.