强化学习 Gym CartPole 倒立摆

强化学习 Gym CartPole 倒立摆

CartPole 倒立摆

import gym

# CartPole 倒立摆
env = gym.make('CartPole-v1', render_mode="human")
for episode in range(10):
    env.reset()
    print("Episode finished after {} timesteps".format(episode))
    for _ in range(100):
        env.render()
        env.step(env.action_space.sample())

env.close()

发表回复

您的电子邮箱地址不会被公开。