Let's simulate the Atari environments by following these steps:
- To run any atari environment for the first time, we need to install the atari dependencies by running this command in the Terminal:
pip install gym[atari]
Alternatively, if you used the second approach in the previous recipe to install gym, you can run the following command instead:
pip install -e '.[atari]'
- After installing the Atari dependencies, we import the gym library in Python:
>>> import gym
- Create an instance of the SpaceInvaders environment:
>>> env = gym.make('SpaceInvaders-v0')
- Reset the environment:
>>> env.reset() array([[[ 0, 0, 0], [ 0, 0, 0], [ 0, 0, 0], ..., ..., [80, 89, 22], [80, 89, 22], [80, 89, 22]]], dtype=uint8)
As you can ...