In [33]:
%matplotlib inline

import gym
import numpy as np
from matplotlib import pyplot as plt

In [34]:
env = gym.envs.make("Breakout-v0")


[2016-11-16 23:36:18,386] Making new env: Breakout-v0

In [35]:
print("Action space size: {}".format(env.action_space.n))
print(env.get_action_meanings())

observation = env.reset()
print("Observation space shape: {}".format(observation.shape))

plt.figure()
plt.imshow(env.render(mode='rgb_array'))

[env.step(2) for x in range(1)]
plt.figure()
plt.imshow(env.render(mode='rgb_array'))

env.render(close=True)


Action space size: 6
['NOOP', 'FIRE', 'RIGHT', 'LEFT', 'RIGHTFIRE', 'LEFTFIRE']
Observation space shape: (210, 160, 3)

In [73]:
# Check out what a cropped image looks like
plt.imshow(observation[34:-16,:,:])


Out[73]:
<matplotlib.image.AxesImage at 0x108de7748>