import gym import gym_minigrid import numpy as np import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' # for auto-reloading external modules # see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython # load, reset, and render an instance of the environment ('MiniGrid-Empty-5x5-v0') env = gym.make('MiniGrid-Empty-5x5-v0') env.reset() before_img = env.render('rgb_array') # take an action and render the resulting state action = env.actions.forward obs, reward, done, info = env.step(action) after_img = env.render('rgb_array') plt.imshow(np.concatenate([before_img, after_img], 1)) print('OOOK')