Gym: CartPole-v0 flash

Created on 5 May 2017  路  4Comments  路  Source: openai/gym

I'm new to openai gym and when i ran the example CartPole-v0 on the site, the simulator flashed (ran very fast). I try to set env.mode='human' but it makes no difference. Is there anyone who has come across the same issue? thx

Most helpful comment

CartPole indeed runs very fast. This is mostly a feature, since it takes thousands of episodes to train an agent. If you want to slow it down, add a time.sleep(0.1) after the call to env.render().

All 4 comments

CartPole indeed runs very fast. This is mostly a feature, since it takes thousands of episodes to train an agent. If you want to slow it down, add a time.sleep(0.1) after the call to env.render().

Thanks. :)

Is this the correct placement of time.sleep(0.1) below?

import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
    env.render()
    time.sleep(0.1)
    env.step(env.action_space.sample()) # take a random action

that code isnt working for me. I use jupyter and have imported all the files (tf, numpy, gym etc.) yet when i run every cell together it just opens a freeze frame of the game. anyone know why this is?

Was this page helpful?
0 / 5 - 0 ratings