From 14f9169b32bfabc0993799f75404655401352f9a Mon Sep 17 00:00:00 2001 From: kywch Date: Wed, 20 Mar 2024 10:15:21 -0700 Subject: [PATCH] added try to local_to_global --- pokemonred_puffer/environment.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index 7fa08ae..297cf6a 100644 --- a/pokemonred_puffer/environment.py +++ b/pokemonred_puffer/environment.py @@ -309,7 +309,7 @@ def init_mem(self): self.seen_hidden_objs = {} self.cut_coords = {} - self.cut_tiles = set([]) + self.cut_tiles = {} # set([]) self.cut_state = deque(maxlen=3) self.seen_start_menu = 0 @@ -809,7 +809,11 @@ def update_seen_coords(self): x_pos, y_pos, map_n = self.get_game_coords() self.seen_coords[(x_pos, y_pos, map_n)] = 1 self.seen_coords_since_blackout.add((x_pos, y_pos, map_n)) - self.explore_map[local_to_global(y_pos, x_pos, map_n)] = 1 + try: + self.explore_map[local_to_global(y_pos, x_pos, map_n)] = 1 + except IndexError: + gy, gx = local_to_global(y_pos, x_pos, map_n) + print(f"coord out of bounds! global: ({gx}, {gy}) game: ({x_pos}, {y_pos}, {map_n})") # self.seen_global_coords[local_to_global(y_pos, x_pos, map_n)] = 1 self.seen_map_ids[map_n] = 1 self.seen_map_ids_since_blackout.add(map_n)