|
6 | 6 | import matplotlib.pyplot as plt |
7 | 7 | import numpy as np |
8 | 8 |
|
9 | | -from axelrod import DEFAULT_TURNS, Player |
| 9 | +from axelrod import DEFAULT_TURNS, Player, Game |
10 | 10 | from .deterministic_cache import DeterministicCache |
11 | 11 | from .graph import complete_graph, Graph |
12 | 12 | from .match import Match |
@@ -40,6 +40,7 @@ def fitness_proportionate_selection(scores: List) -> int: |
40 | 40 | class MoranProcess(object): |
41 | 41 | def __init__(self, players: List[Player], turns: int = DEFAULT_TURNS, |
42 | 42 | prob_end: float = None, noise: float = 0, |
| 43 | + game: Game = None, |
43 | 44 | deterministic_cache: DeterministicCache = None, |
44 | 45 | mutation_rate: float = 0., mode: str = 'bd', |
45 | 46 | interaction_graph: Graph = None, |
@@ -94,6 +95,7 @@ def __init__(self, players: List[Player], turns: int = DEFAULT_TURNS, |
94 | 95 | """ |
95 | 96 | self.turns = turns |
96 | 97 | self.prob_end = prob_end |
| 98 | + self.game = game |
97 | 99 | self.noise = noise |
98 | 100 | self.initial_players = players # save initial population |
99 | 101 | self.players = [] # type: List |
@@ -322,6 +324,7 @@ def score_all(self) -> List: |
322 | 324 | match = Match((player1, player2), |
323 | 325 | turns=self.turns, prob_end=self.prob_end, |
324 | 326 | noise=self.noise, |
| 327 | + game=self.game, |
325 | 328 | deterministic_cache=self.deterministic_cache) |
326 | 329 | match.play() |
327 | 330 | match_scores = match.final_score_per_turn() |
|
0 commit comments