Skip to content

Commit

Permalink
Use dictionary to set default args in Match
Browse files Browse the repository at this point in the history
  • Loading branch information
drvinceknight committed Jun 10, 2017
1 parent d61c957 commit 1c162eb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions axelrod/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ def __init__(self, players, turns=None, prob_end=None,
but these can be overridden if desired.
"""

if turns is None:
self.turns = default_turns if prob_end is None else float('inf')
else:
self.turns = turns

self.prob_end = 0 if prob_end is None else prob_end
defaults = {(True, True): (default_turns, 0),
(True, False): (float('inf'), prob_end),
(False, True): (turns, 0),
(False, False): (turns, prob_end)}
self.turns, self.prob_end = defaults[(turns is None, prob_end is None)]

self.result = []
self.noise = noise
Expand Down

0 comments on commit 1c162eb

Please sign in to comment.