01 Interactive DQN Simulation

Balance is a moving target.

I rebuilt my original CartPole-v1 work as an interactive browser experience that makes the agent’s decisions visible. Watch it read four changing state values, choose a direction, learn from stored experience, and improve as it completes more episodes.

CartPole-v1Deep Q-NetworkReplay MemoryJavaScript Simulation
LIVE ENVIRONMENTReady
CONTROL MODEAI Agent Mode

CartPole simulation

Your browser does not support canvas.
01 / Cart Position0.000
02 / Cart Velocity0.000
03 / Pole Angle0.000°
04 / Pole Velocity0.000

02 Simulation Controls

Run it. Pause it. Push it off balance.

Switch between the trained agent and manual control, then follow the four live state values to see how every left or right movement affects the system.

Q-VALUE UPDATEImmediate reward + discounted future value
q_update = reward + GAMMA × max(Q(next_state))

03 Learning Telemetry

Six numbers tell the story.

Episode0Completed runs
Current Score0Steps survived
100-Run Average0.0Solve goal: 195
Best Score0Maximum: 500
Exploration1.000Random action rate
Replay Memory0Stored experiences

04 Learning Curve

Episode Scores

GOAL // 195 AVG
0 RUNS100-RUN WINDOW

05 Run Output

Training Log

  1. Simulation initialized. The agent is ready.