WUT_Computer_Science/script/main.py

11 lines
435 B
Python
Raw Normal View History

2024-10-27 21:14:26 +01:00
from metadrive.envs.metadrive_env import MetaDriveEnv
import gymnasium as gym
from metadrive.envs.gym_wrapper import createGymWrapper # import the wrapper
2024-10-27 21:14:26 +01:00
env = createGymWrapper(MetaDriveEnv)(config={"use_render": True}) # wrap the environment
obs = env.reset()
2024-10-27 21:14:26 +01:00
for i in range(1000):
obs, reward, done, info = env.step(env.action_space.sample()) # the return value contains no truncate
if done:
2024-10-27 21:14:26 +01:00
env.reset()
env.close()