OpenAI Gym is a platform for developing and evaluating artificial intelligence in games.
-OpenAI opens "training gym for AI" | WIRED.jp
You can build the environment just by doing pip install
or brew install
according to the procedure.
Pac-Man,
Space Invaders,
If you just try this kind of thing at random as a trial, you can do it with about 5 lines of code **, so I don't know about reinforcement learning at all, but it may be a good first step to try it for the time being. Maybe.
Below are the steps I took on ** macOS Sierra ** to build the environment.
The installation procedure is described in the README here.
git clone https://github.com/openai/gym.git
cd gym
pip install -e .
In addition, it will fully install the dependent libraries and so on.
$ brew install cmake boost boost-python sdl2 swig wget
Install it additionally so that it can handle atari games.
$ pip install 'gym[atari]'
A simple sample can be found in the Official Documentation (https://gym.openai.com/docs).
cartpole.py
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample())
When I run it,
$ python cartpole.py
Such a game is executed.
code
invaders.py
import gym
env = gym.make('SpaceInvaders-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample())
Run
$ python invaders.py
code
pacman.py
import gym
env = gym.make('MsPacman-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample())
Run
$ python pacman.py
This time, I tried to build the environment and check the operation easily. I haven't stepped into the essential reinforcement learning by a millimeter yet, so I'd like to write it in another article.
Reference article:
Recommended Posts