Skip to content

Commit

Permalink
copy goal array before giving it to AIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Belissimo-T committed Apr 13, 2024
1 parent c23a882 commit ec87d19
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions seekers/seekers_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,7 @@ def preferred_color(self) -> Color | None:
return self.ai.preferred_color

def init_ai_state(self, goals: list[Goal], players: dict[str, "Player"]):
self._ai_goals = []
for goal in goals:
self._ai_goals.append(
copy.deepcopy(goal)
)
self._ai_goals = [copy.deepcopy(goal) for goal in goals]

self._ai_players = {}
self._ai_seekers = {}
Expand Down Expand Up @@ -690,8 +686,10 @@ def get_ai_input(self,
camps = [p.camp for p in self._ai_players.values()]

return (
my_seekers, other_seekers, all_seekers,
self._ai_goals,
my_seekers,
other_seekers,
all_seekers,
self._ai_goals.copy(),
[player for player in self._ai_players.values() if player is not me],
my_camp, camps,
World(world.width, world.height),
Expand Down

0 comments on commit ec87d19

Please sign in to comment.