Browse Source

Doors can now be closed back after they are opened

Maxime Chevalier-Boisvert 7 năm trước cách đây
mục cha
commit
5d88cb4376
1 tập tin đã thay đổi với 2 bổ sung4 xóa
  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]