in agent_zoo/RoboschoolAtlasForwardWalk_v1_2017jul.py [0:0]
def demo_run():
config = tf.ConfigProto(
inter_op_parallelism_threads=1,
intra_op_parallelism_threads=1,
device_count = { "GPU": 0 } )
sess = tf.InteractiveSession(config=config)
env = gym.make("RoboschoolAtlasForwardWalk-v1")
pi = ZooPolicyTensorflow("mymodel1", env.observation_space, env.action_space)
while 1:
frame = 0
score = 0
restart_delay = 0.0
obs = env.reset()
while 1:
a = pi.act(obs, env)
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.0:
print("score=%0.2f in %i frames" % (score, frame))
if still_open!=True: # not True in multiplayer or non-Roboschool environment
break
restart_delay = time.time() + 1.0
if time.time() > restart_delay:
break