File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change
1
+ from typing import Any , Dict
1
2
from axelrod .action import Action
2
3
from axelrod .evolvable_player import (
3
4
EvolvablePlayer ,
@@ -71,9 +72,11 @@ def __init__(
71
72
self .transitions_D = transitions_D
72
73
self .emission_probabilities = emission_probabilities
73
74
self .state = initial_state
74
- self ._cache_C = dict ()
75
- self ._cache_D = dict ()
75
+ self ._cache_C = dict () # type: Dict[int, int]
76
+ self ._cache_D = dict () # type: Dict[int, int]
76
77
self ._cache_deterministic_transitions ()
78
+ # Random generator will be set by parent strategy
79
+ self ._random = None # type: Any
77
80
78
81
def _cache_deterministic_transitions (self ):
79
82
"""Cache deterministic transitions to avoid unnecessary random draws."""
@@ -217,6 +220,7 @@ def set_seed(self, seed=None):
217
220
super ().set_seed (seed = seed )
218
221
# Share RNG with HMM
219
222
# The evolvable version of the class needs to manually share the rng with the HMM.
223
+ # after initialization.
220
224
try :
221
225
self .hmm ._random = self ._random
222
226
except AttributeError :
You can’t perform that action at this time.
0 commit comments