Cliff Walking: SARSA vs Q-Learning (2D)
Watch two reinforcement-learning agents — on-policy SARSA and off-policy Q-Learning — learn the classic Cliff Walking gridworld side by side on a 2D canvas, with live policy arrows and episode-reward learning curves for both.
Two reinforcement-learning agents train on the same 4×12 "Cliff Walking" gridworld at once — one with on-policy SARSA, the other with off-policy Q-Learning — rendered on a flat 2D canvas with live policy-arrow fields and episode-reward learning curves. Every step costs a small penalty, falling off the cliff costs a large one and resets the agent to start, and reaching the goal ends the episode. Adjust exploration, learning rate and discount factor and watch each agent's Q-value heat-map and arrows reshape themselves: Q-Learning converges on the fast, risky path that hugs the cliff edge, while SARSA learns to give the cliff a wider berth because its updates account for its own exploratory mistakes — a gap you can also see in the two reward curves and the "total training reward" stat, which is typically lower for Q-Learning because it keeps stepping off the cliff during training even as its final greedy policy gets shorter.
Watch two reinforcement-learning agents — on-policy SARSA and off-policy Q-Learning — learn the classic Cliff Walking gridworld side by side, and see why Q-Learning finds the risky path along the cliff edge while SARSA learns a safer detour.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install