A Gym environment turns a reinforcement-learning task into an interactive loop: reset it, inspect the observation, choose an action, receive a reward, and continue until termination. section 11.2
Common environments make different control problems available for experimentation:
- MountainCar requires rocking a car to build momentum up a hill. section 11.2
- Pendulum requires applying force to keep a pendulum upright. section 11.2
- CartPole tests balancing a pole by responding to cart and pole position and velocity. section 11.2
- LunarLander tests landing safely with sufficiently low velocity. section 11.2
Run a random-agent rollout
Create an environment such as CartPole-v1, reset it, sample actions from its action space, call step repeatedly, accumulate rewards, stop when done, and render frames into a video.
