Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix max episode steps problem #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rl2/cartpole/random_search.py
Original file line number Diff line number Diff line change
@@ -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()
3 changes: 2 additions & 1 deletion rl2/cartpole/save_a_video.py
Original file line number Diff line number Diff line change
@@ -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()