Reinforcement Learning (RL)
Q-learning agent in a grid world
A reinforcement-learning agent learns to navigate a 6×6 grid to the goal (+10) while avoiding traps (−10), starting from zero knowledge. Hit Play and watch the arrows — the agent's best-known move in each cell — sharpen as it learns. Tune the hyperparameters below to see how they change learning speed and stability.
Grid world
Arrow shows best action; number below shows the Q-value of that action.
Reward per episode
Total reward earned per episode. Trends upward as learning progresses.
Hyperparameters
Stopping rule
Auto-stops when success rate over last N episodes hits threshold. Hard cap: 500 episodes.
How it works
This uses Q-learning, a classic algorithm that learns the value of taking each action in each cell. The agent balances exploration (random moves, set by ε) against exploitation (its current best guess). After every move it updates its estimate using the reward it got plus the discounted value of where it landed (γ), nudged by the learning rate (α). Over many episodes those estimates converge into a policy — the arrows you see — that reliably reaches the goal.