Created
May 10, 2016 21:06
-
-
Save machinaut/b53714194dd7443a820f9bbd8be2c783 to your computer and use it in GitHub Desktop.
Random agent (run with environment name as argument) for OpenAI gym.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import gym | |
import sys | |
env = gym.make(sys.argv[1]) | |
num_episodes = 200 | |
max_timestep = 1000 | |
env.monitor.start(sys.argv[1]) | |
for _ in xrange(num_episodes): | |
env.reset() | |
for _ in xrange(max_timestep): | |
a = env.action_space.sample() | |
_, _, done, _ = env.step(a) | |
if done: | |
break | |
env.monitor.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment