0.10 0.90 0.20 −0.04 0.00
idle
Episodes
0
Total steps
0
Last return
-
Avg return (20)
-
Goal ✓ (+1) Pit ✗ (−1) Wall Agent High Q Low Q
🔄 Bellman backup: the agent's last Q-update
Step the agent (or run one episode) to see a single Q-value update: value bootstraps from the cell it lands on back into the cell it left.
🧮 Linear function approximation (bridge to deep RL)

Instead of a Q-table with one entry per (state, action), we approximate Q(s,a) = w_a · φ(s). For a 7×9 grid that's 252 numbers tabular vs only 36 with this 9-tile coding (4 actions × 9 tile weights). The trade-off: weights generalize across cells: fewer parameters, but the model can't represent arbitrary value functions.

Update rule: w_a ← w_a + α · (target − Q(s,a)) · φ(s). One TD step changes ALL the active tile weights at once.

500
-
🆚 Compare Q-learning vs SARSA on Cliff Walk

Sutton & Barto, Ch 6.5. Same 4×12 cliff world for both agents. Q-learning learns the optimal policy (walk along the cliff edge); SARSA learns a safer policy (walk along the top row) because it accounts for the cost of falling in due to ε-greedy exploration noise.

500
Q-learning (off-policy)
-
SARSA (on-policy)
-
Average reward per episode (50-episode moving window):
✨ Featured comparison
Featured comparison

Run a short training pass and a longer one. The grid does not receive a plan; it gradually builds value through repeated backup.

Compare early and later policies, then inspect which cells changed most.

🧭 Visual explanation

Live state to watch
No state captured yet. Run or adjust the applet first.
Misread to avoid

📚 Lesson tour (5 steps)
Step 1/5: -

-

📝 Worksheet (3 questions)

Q1. Default grid. Set ε=0. Reset Q-values. Train continuously for ~500 episodes. Does the agent reliably reach the goal?

Q2. Set γ=0, ε=0.2. Reset Q. Train. Q-values (green color) appear:

Q3. Default grid, γ=0.9. Compare α=0.05 vs α=0.8 (same training time, slip=0). The α=0.8 Q-values evolve:

🧪 Student response packet

Predict how exploration and discounting affect learning, train the agent, then explain how value propagates from reward.

State snapshot appears here.
♿ Text and keyboard support

Text and keyboard support

Keyboard path

  • Use Tab and Shift+Tab to move through controls.
  • Use Enter or Space on buttons, and arrow keys on sliders or select controls.
  • The visual region is focusable and described by the state summary below.

Text state summary

Reduced motion and non-visual support

Reduced-motion settings are honored where possible. The current state is also available as text, so the main result does not depend only on color, animation, or spatial position.

Accessibility note: this layer gives a text equivalent for the applet state. It does not replace a full human screen-reader audit.