RoboschoolHumanoidFlagrun_v0_2017may.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:roboschool 作者: openai 项目源码 文件源码
def demo_run():
    env = gym.make("RoboschoolHumanoidFlagrun-v1")
    pi = SmallReactivePolicy(env.observation_space, env.action_space)

    while 1:
        frame = 0
        score = 0
        restart_delay = 0
        obs = env.reset()

        while 1:
            a = pi.act(obs)
            obs, r, done, _ = env.step(a)
            score += r
            frame += 1
            still_open = env.render("human")
            if still_open==False:
                return
            if not done: continue
            if restart_delay==0:
                print("score=%0.2f in %i frames" % (score, frame))
                restart_delay = 60*2  # 2 sec at 60 fps
            else:
                restart_delay -= 1
                if restart_delay==0: break
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号