TaxiDriverGym introduction
In [ ]:
Copied!
import gymnasium as gym
import gymnasium as gym
In [ ]:
Copied!
env = gym.make("Taxi-v3", render_mode='ansi').env
env = gym.make("Taxi-v3", render_mode='ansi').env
In [ ]:
Copied!
print("Action Space {}".format(env.action_space))
print("State Space {}".format(env.observation_space))
print('\n\n')
print("Action Space {}".format(env.action_space))
print("State Space {}".format(env.observation_space))
print('\n\n')
In [ ]:
Copied!
state = env.reset()
print(state[0])
print(env.render())
state = env.reset()
print(state[0])
print(env.render())
In [ ]:
Copied!
# escolhe uma acao aleatoria
action = env.action_space.sample()
print(action)
# escolhe uma acao aleatoria
action = env.action_space.sample()
print(action)
In [ ]:
Copied!
# executa a acao
state, reward, done, truncated, info = env.step(action)
print(state)
print(env.render())
# executa a acao
state, reward, done, truncated, info = env.step(action)
print(state)
print(env.render())
In [ ]:
Copied!
# executa a acao ir para north
state, reward, done, truncated, info = env.step(1)
print(env.render())
# executa a acao ir para north
state, reward, done, truncated, info = env.step(1)
print(env.render())
In [ ]:
Copied!
state, reward, done, truncated, info = env.step(0)
print(env.render())
state, reward, done, truncated, info = env.step(0)
print(env.render())
actions: 0 = south 1 = north 2 = east 3 = west 4 = pickup 5 = dropoff
In [ ]:
Copied!
env.close()
env.close()