Last active
October 19, 2018 11:26
-
-
Save tankala/b33d92e2b46742c0364a79ef5b9c0729 to your computer and use it in GitHub Desktop.
First time we want to understand exactly what happens with CartPole game this code snippet will help you
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 | |
env = gym.make('CartPole-v1') | |
env.reset() | |
for step_index in range(1000): | |
env.render() | |
action = env.action_space.sample() | |
observation, reward, done, info = env.step(action) | |
print("Step {}:".format(step_index)) | |
print("action: {}".format(action)) | |
print("observation: {}".format(observation)) | |
print("reward: {}".format(reward)) | |
print("done: {}".format(done)) | |
print("info: {}".format(info)) | |
if done: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment