瀏覽代碼

Added MiniGrid._rand_color method

Maxime Chevalier-Boisvert 7 年之前
父節點
當前提交
fe469bb1cc
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      gym_minigrid/minigrid.py

+ 7 - 0
gym_minigrid/minigrid.py

@@ -866,6 +866,13 @@ class MiniGridEnv(gym.Env):
         idx = self._rand_int(0, len(lst))
         return lst[idx]
 
+    def _rand_color(self):
+        """
+        Generate a random color name (string)
+        """
+
+        return self._rand_elem(COLOR_NAMES)
+
     def _rand_pos(self, xLow, xHigh, yLow, yHigh):
         """
         Generate a random (x,y) position tuple