What is an RL environment?
Introduction
Project introduction
What is an RL environment?
In reinforcement learning, an agent learns by trying things and seeing what happens. The environment is everything the agent interacts with: the world it lives in, the rules of that world, and the reward that tells it how well it is doing.
Every environment answers the same two questions. Where does an episode start? And when the agent picks an action, what happens next? Those answers live in two functions, reset and step, and nearly every RL library expects them.
Why build the environment yourself?
Most RL mistakes are not in the learning algorithm. They are in the environment: a wall that does not block, an episode that ends at the wrong moment, or a reward that pays for the wrong thing. An agent will find and exploit every one of them.
In this project you build a small grid world piece by piece, test it before training anything, and then watch a learning agent take advantage of a reward that looked reasonable. Fixing it teaches the most important skill in applied RL: designing what the agent is actually rewarded for.
One episode, step by step
5 × 5 gridThis step
What you will build
01
The rules of the world
Movement, rewards, and the difference between finishing the task and running out of time.
02
A reward that cannot be gamed
See why a helpful-looking bonus gets farmed, then build one that cannot be.
03
Honest evaluation
Judge results across many random seeds instead of one lucky run.
Start with movement
Move an agent one cell at a time, with walls and edges that block.