Created
May 22, 2022 18:50
-
-
Save mlabonne/54dae356457931c483b14b80511ed5ae 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
| # 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