Skip to content

Instantly share code, notes, and snippets.

@PuZZleDucK
Created May 21, 2016 07:59
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/2e6798ce66ded5aedf7f7174d3d7d528 to your computer and use it in GitHub Desktop.
Save PuZZleDucK/2e6798ce66ded5aedf7f7174d3d7d528 to your computer and use it in GitHub Desktop.
Simple random action agent playing qbert
#!/usr/bin/python
# My first Atari simulation on the AIgym
# Not much happening yet
import gym
episodes = 500
max_time = 10000
env = gym.make('Qbert-v0')
print env.action_space
print env.observation_space
env.monitor.start('/tmp/atari-experiment-3', force=True)
env.reset()
for episode in range(episodes):
obervation = env.reset()
total_reward = 0
for time in range(max_time):
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