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: Return possible next states and their probabilities.
  
  Only next states with nonzero probabilities will be returned.
  
  Args:
      state (list): start state
      action (int): action
  
  Returns:
      list: a list of pairs (s', p(s'|s,a))
docstr_tok: ["Return","possible","next","states","and","their","probabilities",".","Only","next","states","with","nonzero","probabilities","will","be","returned",".","Args",":","state","(","list",")",":","start","state","action","(","int",")",":","action","Returns",":","list",":","a","list","of","pairs","(","s","'",",","p","(","s'|s",",","a",")",")"]
code: def _get_possible_next_states(self, state, action):
      """Return possible next states and their probabilities.
  
      Only next states with nonzero probabilities will be returned.
  
      Args:
          state (list): start state
          action (int): action
  
      Returns:
          list: a list of pairs (s', p(s'|s,a))
      """
      x = state // self._n_col
      y = state % self._n_col
      coords = np.array([x, y])
  
      increments = np.array([[0, -1], [1, 0], [0, 1], [-1, 0]])
      next_coords = np.clip(
          coords + increments[action],
          [0, 0],
          [self._n_row - 1, self._n_col - 1],
      )
      next_state = next_coords[0] * self._n_col + next_coords[1]
      state_type = self._desc[x, y]
      next_state_type = self._desc[next_coords[0], next_coords[1]]
      if (
          next_state_type == "W"
          or state_type == "H"
          or state_type == "G"
      ):
          return [(state, 1.0)]
      else:
          return [(next_state, 1.0)]
  
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 11 for calling the GridWorldEnv obj's underlying member method code with example usage: obj._get_possible_next_states(state, action) and returns: list, list