diff --git a/pokemonred_puffer/environment.py b/pokemonred_puffer/environment.py index 297cf6a..50686d6 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 = {} self.cut_state = deque(maxlen=3) self.seen_start_menu = 0 @@ -809,11 +809,7 @@ 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)) - 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.explore_map[local_to_global(y_pos, x_pos, map_n)] = 1 # 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) @@ -822,7 +818,7 @@ def get_explore_map(self): explore_map = np.zeros(GLOBAL_MAP_SHAPE) for (x, y, map_n), v in self.seen_coords.items(): gy, gx = local_to_global(y, x, map_n) - if gy >= explore_map.shape[0] or gy < 0 or gx >= explore_map.shape[1] or gx < 0: + if 0 > gy >= explore_map.shape[0] or 0 > gx >= explore_map.shape[1]: print(f"coord out of bounds! global: ({gx}, {gy}) game: ({x}, {y}, {map_n})") else: explore_map[gy, gx] = v diff --git a/pokemonred_puffer/global_map.py b/pokemonred_puffer/global_map.py index 140cbac..7ed6c75 100644 --- a/pokemonred_puffer/global_map.py +++ b/pokemonred_puffer/global_map.py @@ -22,4 +22,4 @@ def local_to_global(r: int, c: int, map_n: int): return r + 0, c + 0 except IndexError: print(f"Coord {map_x}, {map_y} out of bounds for map id {map_n}.") - return -1, -1 + return 0, 0