Tabular reinforcement learning

Watching a Q-table learn

A tabular Q-learning agent on the 4×4 gridworld. Nothing is trained when this page loads — the agent starts knowing nothing, and every frame you play is one more episode it actually lives through. Press Play, or step with −1 / +1, and watch value spread backwards from the goal. The How it works tab explains the world, thealgorithm and what to look for.

Episode0
Episodes lived0 of 1000
Statuslearning
Epsilon1.000
Reward—
Steps—

The Q-table — 16 states × 4 actions

Every number the agent knows. Hover or tab to a cell for its value and how many times it has been tried.

stateupdown leftright

The world — V(s) and the greedy policy

Shading is maxa Q(s,a); the arrow is the action the agent would take. A dot means it has no opinion yet.

Q-value / V(s)

−10−50 +5+10
Rewind moves the playhead back to episode 0 without unlearning anything — “episodes lived” keeps its count and you are replaying what the agent already went through. Retrain throws the agent away and starts a new one from zero knowledge with the current α, γ and ε.

Diverging scale: blue = positive, red = negative, neutral gray at zero, fixed domain ±10 (never auto-scaled). Values are printed in every cell, so the encoding is never colour-alone.