Browse Source

Fix grid hashing (#142)

Conversion of numpy array to string outputs truncated string (different grids result in the same hash)
Vladislav Kurenkov 3 years ago
parent
commit
6f5fe8588d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      gym_minigrid/minigrid.py

+ 1 - 1
gym_minigrid/minigrid.py

@@ -742,7 +742,7 @@ class MiniGridEnv(gym.Env):
         """
         sample_hash = hashlib.sha256()
 
-        to_encode = [self.grid.encode(), self.agent_pos, self.agent_dir]
+        to_encode = [self.grid.encode().tolist(), self.agent_pos, self.agent_dir]
         for item in to_encode:
             sample_hash.update(str(item).encode('utf8'))