Skip to content

Commit

Permalink
set base event flags only once
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Mar 22, 2024
1 parent 6513fdd commit 5470b7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pokemonred_puffer/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 5470b7c

Please sign in to comment.