Browse Source

Fixed bugs with `Goal` `overlap` method.

Lucas Willems 7 years ago
parent
commit
92922b13f7
1 changed files with 2 additions and 2 deletions
  1. 2 2
      gym_minigrid/minigrid.py

+ 2 - 2
gym_minigrid/minigrid.py

@@ -475,7 +475,7 @@ class Grid:
 
 
         return array
         return array
 
 
-    def decode(self, array):
+    def decode(array):
         """
         """
         Decode an array grid encoding back into a grid
         Decode an array grid encoding back into a grid
         """
         """
@@ -762,7 +762,7 @@ class MiniGridEnv(gym.Env):
             targetCell = self.grid.get(newPos[0], newPos[1])
             targetCell = self.grid.get(newPos[0], newPos[1])
             if targetCell == None or targetCell.canOverlap():
             if targetCell == None or targetCell.canOverlap():
                 self.agentPos = newPos
                 self.agentPos = newPos
-            elif targetCell.type == 'goal':
+            if targetCell != None and targetCell.type == 'goal':
                 done = True
                 done = True
                 reward = 1000 - self.stepCount
                 reward = 1000 - self.stepCount