Last active
August 2, 2022 00:32
-
-
Save liketheflower/89e605917fd3b7f9fcfc4d8167aed8ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
import time | |
env = gym.make('MountainCar-v0') | |
env.reset() | |
for t in range(10): | |
print("-"*20 + " "+ str(t) + " "+ "-"*20) | |
env.render() | |
observation = env.reset() | |
action = env.action_space.sample() | |
observation, reward, done, info = env.step(action) | |
print(f"observation: {observation}") | |
print(f"reward: {reward}") | |
print(f"done: {done}") | |
print(f"info {info}") | |
if done: | |
print("Episode finished after {} timesteps".format(t+1)) | |
time.sleep(1) | |
env.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment