diff --git a/gym_maze/envs/maze.py b/gym_maze/envs/maze.py index 2f4e87a..12a87e4 100644 --- a/gym_maze/envs/maze.py +++ b/gym_maze/envs/maze.py @@ -21,6 +21,9 @@ def __init__(self, live_display=False, render_trace=False): """Initialize the maze. DType: list""" + # Random seed with internal gym seeding + self.seed() + # Maze: 0: free space, 1: wall self.maze_generator = maze_generator self.maze = np.array(self.maze_generator.get_maze()) @@ -98,6 +101,11 @@ def step(self, action): return self._get_obs(), reward, done, info + def seed(self, seed=None): + self.np_random, seed = seeding.np_random(seed) + + return [seed] + def reset(self): # Reset maze self.maze = np.array(self.maze_generator.get_maze())