Policy-visible contract
Policy.act() receives one ordered list containing exactly four finite floats and returns one exact integer Action.
| Index | Component | Meaning | Bound |
|---|---|---|---|
0 | cart_position | Horizontal cart position | [-4.8, 4.8] |
1 | cart_velocity | Horizontal cart velocity | unbounded |
2 | pole_angle | Pole angle in radians | ≈ [-0.418, 0.418] |
3 | pole_angular_velocity | Pole angular velocity | unbounded |
0Push left1Push rightStrict Action handling
Invalid Actions are never clipped, repaired, converted, or replaced.
Episode lifecycle
- Derive the split-scoped Environment seed.
- Create a fresh Environment and Policy process.
- Allow state only across act() calls in this Episode.
- Stop on termination, 500 steps, or Policy failure.
Reward and score
Every valid Environment step contributes +1. The Benchmark score is the arithmetic mean of Episode contributions; a Policy failure contributes 0.
Install and evaluate
uv sync --project environments/gymnasium/classic_control/cartpole --extra dev
uv build environments/gymnasium/classic_control/cartpole