Skip to content

Instantly share code, notes, and snippets.

@mlabonne
Created May 22, 2022 18:50
Show Gist options
  • Save mlabonne/54dae356457931c483b14b80511ed5ae to your computer and use it in GitHub Desktop.
Save mlabonne/54dae356457931c483b14b80511ed5ae to your computer and use it in GitHub Desktop.
# Define the sequence of actions
script = ['forward'] * 5 + [''] * 40
env = gym.make('MineRLObtainDiamond-v0')
env = Recorder(env, './video', fps=60)
env.seed(21)
obs = env.reset()
for action in script:
# Get the action space (dict of possible actions)
action_space = env.action_space.noop()
# Activate the selected action in the script
action_space[action] = 1
# Update the environment with the new action space
obs, reward, done, _ = env.step(action_space)
env.release()
env.play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment