Skip to content

Instantly share code, notes, and snippets.

@cocomoff
Created April 18, 2017 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cocomoff/aff7ee699d08c68f79f1c0953d05e9fa to your computer and use it in GitHub Desktop.
Save cocomoff/aff7ee699d08c68f79f1c0953d05e9fa to your computer and use it in GitHub Desktop.
Simple Taxi Domain example using OpenAI Gym
import gym
from gym.wrappers import Monitor
def main():
GAME = "Taxi-v2"
env = gym.make(GAME)
n_state = env.observation_space.n
n_action = env.action_space.n
env = Monitor(env, "taxi_simple", force=True)
s = env.reset()
steps = 10
for step in range(steps):
env.render()
action = env.action_space.sample()
s, r, done, info = env.step(action)
# close environment and monitor
env.close()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment