File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,12 @@ def __init__(
122122 self ._random = RandomGenerator (seed = seed )
123123 self ._bulk_random = BulkRandomGenerator (self ._random .random_seed_int ())
124124 self .set_players ()
125+
126+ # Dedupe initial players as mutation targets
127+ initial_players_by_name = {
128+ player .name : player for player in self .initial_players
129+ }
130+ self .mutation_targets = [pi for pi in initial_players_by_name .values ()]
125131
126132 if interaction_graph is None :
127133 interaction_graph = complete_graph (len (players ), loops = False )
@@ -211,7 +217,7 @@ def mutate(self, index: int) -> Player:
211217 # Choose another strategy at random from the initial population
212218 player = None
213219 while player is None or str (player ) == str (self .players [index ]):
214- player = self ._random .choice (self .initial_players )
220+ player = self ._random .choice (self .mutation_targets )
215221 return player .clone ()
216222
217223 def death (self , index : int = None ) -> int :
You can’t perform that action at this time.
0 commit comments