diff --git a/rl2/cartpole/random_search.py b/rl2/cartpole/random_search.py index 77ea36d6..1b16b2e3 100644 --- a/rl2/cartpole/random_search.py +++ b/rl2/cartpole/random_search.py @@ -19,7 +19,7 @@ def play_one_episode(env, params): done = False t = 0 - while not done and t < 10000: + while not done: # env.render() t += 1 action = get_action(observation, params) @@ -58,6 +58,7 @@ def random_search(env): if __name__ == '__main__': env = gym.make('CartPole-v0') + env._max_episode_steps = 10000 episode_lengths, params = random_search(env) plt.plot(episode_lengths) plt.show() diff --git a/rl2/cartpole/save_a_video.py b/rl2/cartpole/save_a_video.py index 31690c29..c423e3b7 100644 --- a/rl2/cartpole/save_a_video.py +++ b/rl2/cartpole/save_a_video.py @@ -20,7 +20,7 @@ def play_one_episode(env, params): done = False t = 0 - while not done and t < 10000: + while not done: t += 1 action = get_action(observation, params) observation, reward, done, info = env.step(action) @@ -58,6 +58,7 @@ def random_search(env): if __name__ == '__main__': env = gym.make('CartPole-v0') + env._max_episode_steps = 10000 episode_lengths, params = random_search(env) plt.plot(episode_lengths) plt.show() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy