Maxime Chevalier-Boisvert пре 7 година
родитељ
комит
342b3c96f1
2 измењених фајлова са 5 додато и 0 уклоњено
  1. 1 0
      gym_minigrid/minigrid.py
  2. 4 0
      run_tests.py

+ 1 - 0
gym_minigrid/minigrid.py

@@ -869,6 +869,7 @@ class MiniGridEnv(gym.Env):
         Set the agent's starting point at an empty position in the grid
         Set the agent's starting point at an empty position in the grid
         """
         """
 
 
+        self.start_pos = None
         pos = self.place_obj(None, top, size)
         pos = self.place_obj(None, top, size)
         self.start_pos = pos
         self.start_pos = pos
 
 

+ 4 - 0
run_tests.py

@@ -43,6 +43,10 @@ for envName in env_list:
 
 
         obs, reward, done, info = env.step(action)
         obs, reward, done, info = env.step(action)
 
 
+        # Validate the agent position
+        assert env.agent_pos[0] < env.grid_size
+        assert env.agent_pos[1] < env.grid_size
+
         # Test observation encode/decode roundtrip
         # Test observation encode/decode roundtrip
         img = obs['image']
         img = obs['image']
         grid = Grid.decode(img)
         grid = Grid.decode(img)