diff --git a/main.py b/main.py index 77dcb23..021f40e 100644 --- a/main.py +++ b/main.py @@ -39,7 +39,7 @@ def _valid_target(target): return ( 0 <= target[0] < MAZE.shape[0] and 0 <= target[1] < MAZE.shape[1] and - MAZE[tuple(target)] != '1' + MAZE[tuple(target)] != b'1' ) @@ -52,7 +52,7 @@ def init_global(maze_filename): maze_filename, dtype='|S1', ) - state_mask = (MAZE != '1') + state_mask = (MAZE != b'1') S_TO_IJ = np.indices(MAZE.shape).transpose(1, 2, 0)[state_mask] SN = len(S_TO_IJ) @@ -62,12 +62,12 @@ def init_global(maze_filename): # One step cost functions initialization maze_cost = np.zeros(MAZE.shape, dtype=np.float64) - maze_cost[MAZE == '1'] = np.nan - maze_cost[(MAZE == '0') | (MAZE == 'S')] = 0 - maze_cost[MAZE == 'T'] = 50 - maze_cost[MAZE == 'G'] = -1 + maze_cost[MAZE == b'1'] = np.nan + maze_cost[(MAZE == b'0') | (MAZE == b'S')] = 0 + maze_cost[MAZE == b'T'] = 50 + maze_cost[MAZE == b'G'] = -1 G1_X = maze_cost.copy()[state_mask] - maze_cost[(MAZE=='0') | (MAZE=='S') | (MAZE=='G')] += 1 + maze_cost[(MAZE==b'0') | (MAZE==b'S') | (MAZE==b'G')] += 1 G2_X = maze_cost.copy()[state_mask] # Actual environment modelling