diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index d0a735e..94aca26 100644 --- a/pokemonred_puffer/environment.py +++ b/pokemonred_puffer/environment.py @@ -656,7 +656,8 @@ def cut_if_next(self): self.pyboy.tick(self.action_freq, render=True) # find pokemon with cut - while True: + # We run this over all pokemon so we dont end up in an infinite for loop + for _ in range(7): self.pyboy.send_input(WindowEvent.PRESS_ARROW_DOWN) self.pyboy.send_input(WindowEvent.RELEASE_ARROW_DOWN, delay=8) self.pyboy.tick(self.action_freq, render=True)