Sfoglia il codice sorgente

in `FlatObsWrapper`, add support for `,` symbol in missions

saleml 2 anni fa
parent
commit
6058520362
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      gym_minigrid/wrappers.py

+ 3 - 1
gym_minigrid/wrappers.py

@@ -376,7 +376,7 @@ class FlatObsWrapper(ObservationWrapper):
         super().__init__(env)
 
         self.maxStrLen = maxStrLen
-        self.numCharCodes = 27
+        self.numCharCodes = 28
 
         imgSpace = env.observation_space.spaces["image"]
         imgSize = reduce(operator.mul, imgSpace.shape, 1)
@@ -410,6 +410,8 @@ class FlatObsWrapper(ObservationWrapper):
                     chNo = ord(ch) - ord("a")
                 elif ch == " ":
                     chNo = ord("z") - ord("a") + 1
+                elif ch == ",":
+                    chNo = ord("z") - ord("a") + 2
                 else:
                     raise ValueError(
                         f"Character {ch} is not available in mission string."