class_docstr: A simply 2D grid environment.
  
  | 'S' : starting point
  | 'F' or '.': free space
  | 'W' or 'x': wall
  | 'H' or 'o': hole (terminates episode)
  | 'G' : goal
class_docstr_tok: ["A","simply","2D","grid","environment",".","|","'S","'",":","starting","point","|","'","F","'","or","'",".","'",":","free","space","|","'","W","'","or","'","x","'",":","wall","|","'","H","'","or","'","o","'",":","hole","(","terminates","episode",")","|","'","G","'",":","goal"]
docstr: Initialize the environment.
  
  Args:
      desc (str): grid configuration key.
      max_episode_length (int): The maximum steps allowed for an episode.
docstr_tok: ["Initialize","the","environment",".","Args",":","desc","(","str",")",":","grid","configuration","key",".","max_episode_length","(","int",")",":","The","maximum","steps","allowed","for","an","episode","."]
code: def __init__(self, desc="4x4", max_episode_length=None):
      """Initialize the environment.
  
      Args:
          desc (str): grid configuration key.
          max_episode_length (int): The maximum steps allowed for an episode.
      """
      if isinstance(desc, str):
          desc = MAPS[desc]
      desc = np.array(list(map(list, desc)))
      desc[desc == "."] = "F"
      desc[desc == "o"] = "H"
      desc[desc == "x"] = "W"
      self._desc = desc
      self._n_row, self._n_col = desc.shape
      (start_x,), (start_y,) = np.nonzero(desc == "S")
      self._start_state = start_x * self._n_col + start_y
      self._state = None
      self._domain_fig = None
  
      self._step_cnt = None
      self._max_episode_length = max_episode_length
  
      self._action_space = akro.Discrete(4)
      self._observation_space = akro.Discrete(self._n_row * self._n_col)
      self._spec = EnvSpec(
          action_space=self.action_space,
          observation_space=self.observation_space,
          max_episode_length=max_episode_length,
      )
  
file_path: garage/src/garage/envs/grid_world_env.py
imports: import akro
  import numpy
  from garage import Environment, EnvSpec, EnvStep, StepType
label_desc: Use image node_id 1 to create a new GridWorldEnv object from inherited base classes: Environment with example: obj = GridWorldEnv(desc, max_episode_length)