Skip to content

Commit

Permalink
Added check for invalid actions to dynamic obstacles.
Browse files Browse the repository at this point in the history
In response to #63
  • Loading branch information
maximecb committed May 15, 2019
1 parent 051761e commit f3db6a7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gym_minigrid/envs/dynamicobstacles.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def _gen_grid(self, width, height):
self.mission = "get to the green goal square"

def step(self, action):
# Invalid action
if action >= self.action_space.n:
action = 0

obs, reward, done, info = MiniGridEnv.step(self, action)

# Update obstacle positions
Expand Down

0 comments on commit f3db6a7

Please sign in to comment.