-
-
Save sosiristseng/b57eb8c05b2b9126d48e763206a1667a to your computer and use it in GitHub Desktop.
Cartpole using simple policy
This file contains 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 numpy as np | |
import gym | |
from gym import wrappers | |
env = gym.make('CartPole-v1') | |
env = wrappers.Monitor(env, '/tmp/cartpole-experiment-v1', force=True) | |
for i_episode in range(100): | |
observation = env.reset() | |
while True: | |
action = np.argmax([0,observation[2] + observation[3]]) | |
observation, reward, done, _ = env.step(action) | |
if done: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment