in gym/gym/envs/toy_text/cliffwalking.py [0:0]
def _render(self, mode='human', close=False):
if close:
return
outfile = sys.stdout
for s in range(self.nS):
position = np.unravel_index(s, self.shape)
if self.s == s:
output = " x "
# Print terminal state
elif position == (3, 11):
output = " T "
elif self._cliff[position]:
output = " C "
else:
output = " o "
if position[1] == 0:
output = output.lstrip()
if position[1] == self.shape[1] - 1:
output = output.rstrip()
output += '\n'
outfile.write(output)
outfile.write('\n')