Unbreak random_agent (#406)

The semantics of `env.reset()` have changed. It's no longer possible
to reset an environment until it's done.

Notably, this commit changes the behavior of random_agent. It used
to have a limit on number of actions per episode. If we wanted
that now, we'd have to close the environment and recreate it
on each episode, which may be slow.
This commit is contained in:
Avital Oliver
2016-12-06 17:07:23 -08:00
committed by Greg Brockman
parent 057862d83f
commit 8676fa858f

View File

@@ -48,14 +48,12 @@ if __name__ == '__main__':
agent = RandomAgent(env.action_space)
episode_count = 100
max_steps = 200
reward = 0
done = False
for i in range(episode_count):
ob = env.reset()
for j in range(max_steps):
while True:
action = agent.act(ob, reward, done)
ob, reward, done, _ = env.step(action)
if done: