123456789101112131415161718192021222324 |
- #!/usr/bin/env python3
- import time
- import gym
- def _main():
- env = gym.make("CartPole-v0")
- env.reset()
- env.render()
- while True:
- action = env.action_space.sample()
- observation, reward, done, info = env.step(action)
- env.render()
- assert not info
- print(action, observation, reward)
- if done:
- break
- time.sleep(21)
- if __name__ == "__main__":
- _main()
|