Rodrigo Perez-Vicente пре 2 година
родитељ
комит
1b44dcc7d7
1 измењених фајлова са 7 додато и 1 уклоњено
  1. 7 1
      gym_minigrid/minigrid.py

+ 7 - 1
gym_minigrid/minigrid.py

@@ -253,8 +253,14 @@ class Door(WorldObj):
         elif self.is_locked:
             state = 2
         # if door is closed and unlocked
-        else:
+        elif not self.is_open:
             state = 1
+        else:
+            raise ValueError(
+                "There is no possible state encoding for the state:\n -Door Open: {}\n -Door Closed: {}\n -Door Locked: {}".format(
+                    self.is_open, not self.is_open, self.is_locked
+                )
+            )
 
         return (OBJECT_TO_IDX[self.type], COLOR_TO_IDX[self.color], state)