Selaa lähdekoodia

pre-commit now works

saleml 2 vuotta sitten
vanhempi
commit
602010892b
2 muutettua tiedostoa jossa 11 lisäystä ja 13 poistoa
  1. 2 4
      gym_minigrid/envs/obstructedmaze.py
  2. 9 9
      gym_minigrid/wrappers.py

+ 2 - 4
gym_minigrid/envs/obstructedmaze.py

@@ -67,8 +67,7 @@ class ObstructedMazeEnv(RoomGrid):
         if blocked:
             vec = DIR_TO_VEC[door_idx]
             blocking_ball = Ball(self.blocking_ball_color) if blocked else None
-            self.grid.set(door_pos[0] - vec[0],
-                          door_pos[1] - vec[1], blocking_ball)
+            self.grid.set(door_pos[0] - vec[0], door_pos[1] - vec[1], blocking_ball)
 
         if locked:
             obj = Key(door.color)
@@ -106,8 +105,7 @@ class ObstructedMaze_1Dlhb(ObstructedMazeEnv):
             blocked=self.blocked,
         )
 
-        self.obj, _ = self.add_object(
-            1, 0, "ball", color=self.ball_to_find_color)
+        self.obj, _ = self.add_object(1, 0, "ball", color=self.ball_to_find_color)
         self.place_agent(0, 0)
 
 

+ 9 - 9
gym_minigrid/wrappers.py

@@ -98,7 +98,7 @@ class StateBonus(gym.Wrapper):
         return self.env.reset(**kwargs)
 
 
-class ImgObsWrapper(gym.ObservationWrapper):
+class ImgObsWrapper(gym.Wrapper):
     """
     Use the image as the only observation output, no language/mission.
     """
@@ -111,7 +111,7 @@ class ImgObsWrapper(gym.ObservationWrapper):
         return obs["image"]
 
 
-class OneHotPartialObsWrapper(gym.ObservationWrapper):
+class OneHotPartialObsWrapper(gym.Wrapper):
     """
     Wrapper to get a one-hot encoding of a partially observable
     agent view as observation.
@@ -151,7 +151,7 @@ class OneHotPartialObsWrapper(gym.ObservationWrapper):
         return {**obs, "image": out}
 
 
-class RGBImgObsWrapper(gym.ObservationWrapper):
+class RGBImgObsWrapper(gym.Wrapper):
     """
     Wrapper to use fully observable RGB image as observation,
     This can be used to have the agent to solve the gridworld in pixel space.
@@ -183,7 +183,7 @@ class RGBImgObsWrapper(gym.ObservationWrapper):
         return {**obs, "image": rgb_img}
 
 
-class RGBImgPartialObsWrapper(gym.ObservationWrapper):
+class RGBImgPartialObsWrapper(gym.Wrapper):
     """
     Wrapper to use partially observable RGB image as observation.
     This can be used to have the agent to solve the gridworld in pixel space.
@@ -214,7 +214,7 @@ class RGBImgPartialObsWrapper(gym.ObservationWrapper):
         return {**obs, "image": rgb_img_partial}
 
 
-class FullyObsWrapper(gym.ObservationWrapper):
+class FullyObsWrapper(gym.Wrapper):
     """
     Fully observable gridworld using a compact grid encoding
     """
@@ -243,7 +243,7 @@ class FullyObsWrapper(gym.ObservationWrapper):
         return {**obs, "image": full_grid}
 
 
-class DictObservationSpaceWrapper(gym.ObservationWrapper):
+class DictObservationSpaceWrapper(gym.Wrapper):
     """
     Transforms the observation space (that has a textual component) to a fully numerical observation space,
     where the textual instructions are replaced by arrays representing the indices of each word in a fixed vocabulary.
@@ -361,7 +361,7 @@ class DictObservationSpaceWrapper(gym.ObservationWrapper):
         return obs
 
 
-class FlatObsWrapper(gym.ObservationWrapper):
+class FlatObsWrapper(gym.Wrapper):
     """
     Encode mission strings using a one-hot scheme,
     and combine these with observed images into one flat array
@@ -455,7 +455,7 @@ class ViewSizeWrapper(gym.Wrapper):
         return {**obs, "image": image}
 
 
-class DirectionObsWrapper(gym.ObservationWrapper):
+class DirectionObsWrapper(gym.Wrapper):
     """
     Provides the slope/angular direction to the goal with the observations as modeled by (y2 - y2 )/( x2 - x1)
     type = {slope , angle}
@@ -489,7 +489,7 @@ class DirectionObsWrapper(gym.ObservationWrapper):
         return obs
 
 
-class SymbolicObsWrapper(gym.ObservationWrapper):
+class SymbolicObsWrapper(gym.Wrapper):
     """
     Fully observable grid with a symbolic state representation.
     The symbol is a triple of (X, Y, IDX), where X and Y are