def get_state_xy(idx, num_cols):
  """Given state index this method returns its equivalent coordinate (x,y).

  Args:
    idx: index uniquely identifying a state
    num_cols: number of colums

  Returns:
  values x, y describing the state's location in the grid
  """
  y = int(idx % num_cols)
  x = int((idx - y) / num_cols)
  return x, y