Skip to content

Commit

Permalink
Properly reset step count
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Oct 21, 2024
1 parent 73cb1cd commit 61ab4c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pokemonred_puffer/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,9 @@ def step(self, action):

self.step_count += 1

if self.step_count >= self.get_max_steps():
self.step_count = 0

# cut mon check
reset = False
if not self.party_has_cut_capable_mon():
Expand Down
6 changes: 3 additions & 3 deletions pokemonred_puffer/wrappers/exploration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from omegaconf import DictConfig
from pokemonred_puffer.environment import RedGymEnv
from pokemonred_puffer.global_map import GLOBAL_MAP_SHAPE, local_to_global
from pokemonred_puffer.global_map import local_to_global


class LRUCache:
Expand Down Expand Up @@ -115,8 +115,8 @@ def step(self, action):
if self.env.unwrapped.step_count >= self.env.unwrapped.get_max_steps():
if (self.counter + random.randint(0, self.jitter)) >= self.full_reset_frequency:
self.counter = 0
self.env.unwrapped.explore_map = np.zeros(GLOBAL_MAP_SHAPE, dtype=np.float32)
self.env.unwrapped.cut_explore_map = np.zeros(GLOBAL_MAP_SHAPE, dtype=np.float32)
self.env.unwrapped.explore_map *= 0
self.env.unwrapped.cut_explore_map *= 0
self.env.unwrapped.seen_coords.clear()
self.env.unwrapped.seen_map_ids *= 0
self.env.unwrapped.seen_npcs.clear()
Expand Down

0 comments on commit 61ab4c4

Please sign in to comment.