Skip to content

Commit

Permalink
Use the random module for sampling team.
Browse files Browse the repository at this point in the history
Using numpy causes problems for building the docs. Building the docs
mocks numpy (I believe this is because readthedocs can't handle numpy),
which in turn broke when importing axelrod (for the auto documentation)
as various filtered lists are created when importing. MWE Random is the
first strategy that initialises and classifies itself stochasticly...
  • Loading branch information
drvinceknight committed Dec 4, 2016
1 parent b97d413 commit b157d91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion axelrod/strategies/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
AlternatorHunter, CooperatorHunter, CycleHunter, DefectorHunter,
EventualCycleHunter, MathConstantHunter, RandomHunter,)
from numpy.random import choice
from random import sample

# Needs to be computed manually to prevent circular dependency
ordinary_strategies = [s for s in all_strategies if obey_axelrod(s)]
Expand Down Expand Up @@ -497,5 +498,5 @@ class MWERandom(MetaWinnerEnsemble):
@init_args
def __init__(self):
l = len(ordinary_strategies)
team = list(choice([s for s in ordinary_strategies], int(l / 4)))
team = sample([s for s in ordinary_strategies], int(l / 4))
super(MWERandom, self).__init__(team=team)

0 comments on commit b157d91

Please sign in to comment.