Skip to content

Instantly share code, notes, and snippets.

@EliasGit2017
Last active August 17, 2020 00:07
Show Gist options
  • Save EliasGit2017/7a89a93b7c8b70503a952873a343316b to your computer and use it in GitHub Desktop.
Save EliasGit2017/7a89a93b7c8b70503a952873a343316b to your computer and use it in GitHub Desktop.
little note on gym
import gym
import time
env = gym.make("CartPole-v1")
observation = env.reset()
for _ in range(10000):
env.render()
action = env.action_space.sample() # your agent here (this takes random actions)
observation, reward, done, info = env.step(action)
time.sleep(0.02)
if done:
observation = env.reset()
env.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment