chore: metadrivee <hello_world>

This commit is contained in:
Krzysztof Rudnicki 2024-10-27 20:27:56 +01:00
parent 0b954cb1ea
commit ee59f88e4c
2 changed files with 18 additions and 9 deletions

23
main.py
View File

@ -1,11 +1,16 @@
import gymnasium as gym
env = gym.make("LunarLander-v2", render_mode="human")
observation, info = env.reset(seed=42)
for _ in range(1000):
action = env.action_space.sample() # this is where you would insert your policy
observation, reward, terminated, truncated, info = env.step(action)
import metadrive
if terminated or truncated:
observation, info = env.reset()
# Initialize the MetaDrive environment
env = metadrive.MetaDriveEnv()
env.close()
# Reset the environment to start a new episode
env.reset()
# Run the environment for a few steps
for _ in range(10):
env.step(env.action_space.sample()) # Take random actions
print("Hello, MetaDrive World!") # Print a greeting
# Close the environment after use
env.close()

View File

@ -1 +1,5 @@
metadrive
ray
rlib
ray[rllib]
metadrive-simulator