From 5470b7c819f564d99ca8d3787ff7166e7a919431 Mon Sep 17 00:00:00 2001 From: thatguy11325 <148832074+thatguy11325@users.noreply.github.com> Date: Fri, 22 Mar 2024 12:41:18 -0400 Subject: [PATCH] set base event flags only once --- pokemonred_puffer/environment.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index 77e1372..a109d3d 100644 --- a/pokemonred_puffer/environment.py +++ b/pokemonred_puffer/environment.py @@ -262,6 +262,11 @@ def reset(self, seed: Optional[int] = None): if not seed: seed = random.randint(0, 4096) self.pyboy.tick(seed, render=False) + self.base_event_flags = sum( + self.read_m(i).bit_count() + for i in range(EVENT_FLAGS_START, EVENT_FLAGS_START + EVENTS_FLAGS_LENGTH) + ) + else: self.reset_count += 1 @@ -275,11 +280,6 @@ def reset(self, seed: Optional[int] = None): self.reset_mem() self.taught_cut = self.check_if_party_has_cut() - self.base_event_flags = sum( - self.read_m(i).bit_count() - for i in range(EVENT_FLAGS_START, EVENT_FLAGS_START + EVENTS_FLAGS_LENGTH) - ) - self.levels_satisfied = False self.base_explore = 0 self.max_opponent_level = 0