Gym documentation#
Gym is a standard API for reinforcement learning, and a diverse collection of reference environments.#
![Lunar Lander](https://user-images.githubusercontent.com/15806078/153222406-af5ce6f0-4696-4a24-a683-46ad4939170c.gif)
The Gym interface is simple, pythonic, and capable of representing general RL problems:
import gym
env = gym.make("LunarLander-v2")
observation, info = env.reset(seed=42, return_info=True)
for _ in range(1000):
env.render()
action = policy(observation) # User-defined policy function
observation, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
observation, info = env.reset(return_info=True)
env.close()