OpenAI Gym provides reinforcement-learning environments that expose observations, actions, rewards, resets, and episode termination. CartPole turns these interfaces into a concrete control problem: keep a pole upright while maximizing cumulative reward. section 12.3
CartPole with reinforcement-learning libraries
A2C or PPO can train an MLP policy on CartPole-v1 for 10,000 timesteps, then evaluate the policy over multiple episodes and render its behavior.
Figure 12.8 CartPole balancing problem
Use the CartPole figure alongside the implementation listings to connect state-action interaction with the training loop. section 12.3


