Skip to content

Instantly share code, notes, and snippets.

@PuZZleDucK
Created May 21, 2016 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PuZZleDucK/c7eccccfb10fedc3c17370a977ae2b66 to your computer and use it in GitHub Desktop.
Save PuZZleDucK/c7eccccfb10fedc3c17370a977ae2b66 to your computer and use it in GitHub Desktop.
My first Atari simulation with simple summary of results
#!/usr/bin/python
# My first Atari simulation on the AIgym
# Not much happening yet
import gym
env = gym.make('MsPacman-v0')
print env.action_space
print env.observation_space
env.monitor.start('/tmp/atari-experiment-2')
env.reset()
for episode in range(20):
obervation = env.reset()
total_reward = 0
for time in range(1000):
env.render()
action = env.action_space.sample()
observation, reward, done, info = env.step(action)
total_reward = total_reward + reward
if done:
print "Episode {}:".format(episode)
print " completed in {} steps".format(time+1)
print " total_reward was {}".format(total_reward)
break
env.monitor.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment