Playground
Watch an agent learn.
The blue agent starts in the bottom-left corner and must reach the flag. Each step costs a little, walls block the way, and the red pit is a heavy penalty. It learns with Q-learning, entirely in your browser.
Gridworld demo
20% of moves are random.
Untrained: the agent has no idea where the goal is yet.
- Agent
- Goal (+10)
- Pit (−10)
- Wall
How it works
A table of good guesses.
The agent keeps a score, called a Q-value, for every square and direction. After each move it nudges that score toward the reward it got plus the best score it expects next. Arrows show its current favourite move; darker squares are ones it values more.
- Learning rate 0.5How strongly each new experience updates a score.
- Discount 0.9Future rewards count slightly less than immediate ones.
- Step cost −0.1A small penalty that encourages short routes.
- ExplorationWith probability epsilon the agent tries a random move instead of its favourite.