From b9e735c253071984ca36eb00cbc5a748899bac8f Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Mon, 21 Nov 2016 18:18:49 -0800 Subject: [PATCH] Unbreak random_agent 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. --- examples/agents/random_agent.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/agents/random_agent.py b/examples/agents/random_agent.py index 38f59571f85..42ffa063435 100644 --- a/examples/agents/random_agent.py +++ b/examples/agents/random_agent.py @@ -48,14 +48,12 @@ def act(self, observation, reward, done): 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: