def get_neighbor_encoding(self, cell: Cell): arr = [] x, y = cell.get_x(), cell.get_y() for dx in range(-1, 2): for dy in range(-1, 2): if not dx and not dy: continue if self.in_bound(x + dx, y + dy): arr.append(self.map[x + dx][y + dy]) else: arr.append(None) return [CELL_ENCODE[decode(c)] for c in arr]
def get_neighbor_move_encoding(self, unit: Unit, cell: Cell): arr = [] x, y = cell.get_x(), cell.get_y() for dx in range(-1, 2): for dy in range(-1, 2): if not dx and not dy: continue if self.in_bound(x + dx, y + dy): # Might need to remove this if not self.map[x + dx][y + dy].is_capturable( ME, unit.get_level()): arr.append(None) else: arr.append(self.map[x + dx][y + dy]) else: arr.append(None) return [CELL_ENCODE[decode(c)] for c in arr]