From 9cc652def9b4ddf8c2a9cae9419cbce60a038aa0 Mon Sep 17 00:00:00 2001 From: thatguy11325 <148832074+thatguy11325@users.noreply.github.com> Date: Sat, 1 Jun 2024 07:42:24 -0400 Subject: [PATCH] No inf whiles --- pokemonred_puffer/environment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)