Spaces:
Sleeping
Sleeping
File size: 531 Bytes
7890d53 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gym_super_mario_bros
from gym_super_mario_bros.actions import RIGHT_ONLY
from nes_py.wrappers import JoypadSpace
ENV_NAME = 'SuperMarioBros-1-1-v0'
env = gym_super_mario_bros.make(ENV_NAME, render_mode='human', apply_api_compatibility=True)
env = JoypadSpace(env, RIGHT_ONLY)
done = False
env.reset()
counter = 0
while not done:
# Only go right
# action = RIGHT_ONLY.index(['right'])
# Choose random action
action = env.action_space.sample()
_, _, done, _, _ = env.step(action)
env.render() |