Przeglądaj źródła

Doors can now be closed back after they are opened

Maxime Chevalier-Boisvert 7 lat temu
rodzic
commit
5d88cb4376
1 zmienionych plików z 2 dodań i 4 usunięć
  1. 2 4
      gym_minigrid/minigrid.py

+ 2 - 4
gym_minigrid/minigrid.py

@@ -152,10 +152,8 @@ class Door(WorldObj):
         return self.is_open
 
     def toggle(self, env, pos):
-        if not self.is_open:
-            self.is_open = True
-            return True
-        return False
+        self.is_open = not self.is_open
+        return True
 
     def render(self, r):
         c = COLORS[self.color]