瀏覽代碼

make _gen_grid abstract

saleml 2 年之前
父節點
當前提交
9f3e5e9055
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      gym_minigrid/minigrid.py

+ 3 - 1
gym_minigrid/minigrid.py

@@ -1,4 +1,5 @@
 import hashlib
 import hashlib
+from abc import abstractmethod
 import math
 import math
 import string
 import string
 from enum import IntEnum
 from enum import IntEnum
@@ -823,8 +824,9 @@ class MiniGridEnv(gym.Env):
 
 
         return str
         return str
 
 
+    @abstractmethod
     def _gen_grid(self, width, height):
     def _gen_grid(self, width, height):
-        assert False, "_gen_grid needs to be implemented by each environment"
+        pass
 
 
     def _reward(self):
     def _reward(self):
         """
         """