Skip to content

Commit b42bb0f

Browse files
committed
Add a test to the moran process for custom match
1 parent 5a72f72 commit b42bb0f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

axelrod/tests/unit/test_moran.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,19 @@ def test_different_game(self):
191191
mp = MoranProcess((p1, p2), turns=5, game=game, seed=3)
192192
populations = mp.play()
193193
self.assertEqual(mp.winning_strategy_name, str(p1))
194+
195+
def test_different_match(self):
196+
# Using a different game where the scores are all the same
197+
# This is a test to mainly show that the results are different to the
198+
# results of `test_different_game` where the same seed is used.
199+
class StandInMatch(axl.Match):
200+
"""A Match were all players get a score of 3"""
201+
def final_score_per_turn(self):
202+
return 0, 3
203+
p1, p2 = axl.Cooperator(), axl.Defector()
204+
game = axl.Game(r=4, p=2, s=1, t=6)
205+
mp = MoranProcess((p1, p2), turns=5, game=game, match_class=StandInMatch, seed=3)
206+
populations = mp.play()
194207
self.assertEqual(mp.winning_strategy_name, str(p2))
195208

196209
def test_death_birth(self):

0 commit comments

Comments
 (0)