Created
May 1, 2016 07:13
-
-
Save anonymous/de3e7e1f5919511ca77d3f3c02015b36 to your computer and use it in GitHub Desktop.
This file contains 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/python | |
import gym | |
import sys | |
import os | |
try: | |
test = str(sys.argv[1]) | |
env = gym.make(test) | |
env.monitor.start('/tmp/{0}-1'.format(test[2:])) | |
env.reset() | |
counter = 0 | |
while 1: | |
tick = counter + 1 | |
counter = tick | |
env.render() | |
action = env.action_space.sample() # take a random action | |
observation, reward, done, info = env.step(action) | |
print observation | |
if done: | |
apikey = file('APIKey', 'r').read() | |
print "Episode {0} finished".format(counter) | |
env.monitor.close() | |
writeup = os.popen("gist OpenAI").read() | |
gym.upload('/tmp/{0}-1'.format(test[2:]), writeup=writeup,api_key=str(apikey).strip("\n")) | |
break | |
except KeyboardInterrupt: | |
env.monitor.close() | |
sys.exit() | |
except IndexError: | |
print "Error! Missing Test." | |
print "Please run: " | |
print "{0} Test-v0".format(sys.argv[0]) | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment