Skip to content

Instantly share code, notes, and snippets.

@stefanopalmieri
Last active December 20, 2019 07:00
Show Gist options
  • Save stefanopalmieri/cdd42d4bd9c806c644de7e7ca86e59b0 to your computer and use it in GitHub Desktop.
Save stefanopalmieri/cdd42d4bd9c806c644de7e7ca86e59b0 to your computer and use it in GitHub Desktop.
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