Last active
August 17, 2020 00:07
-
-
Save EliasGit2017/7a89a93b7c8b70503a952873a343316b to your computer and use it in GitHub Desktop.
little note on 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
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