Learn the value of each action by trial and error — no map of the world required.
Q-learning learns good behaviour without ever being told how the world works. It keeps a Q(s, a) value for each state-action pair — an estimate of the total future reward that move is worth — and refines those estimates purely from experience. The 'Q' stands for the quality of a move.
After taking action a in state s, receiving reward r, and landing in s', nudge the old estimate toward a better target: the reward just earned plus the discounted value of the best move available next.
Q(s, a) <- Q(s, a) + α · [ r + γ · max_a' Q(s', a') - Q(s, a) ]
\________ target ________/ \__ old __/
# α = learning rate γ = discount the bracket is the TD errorQ(s', a') — its *own current estimate* of the next state — as part of the target. This is temporal-difference (TD) learning: each value is refined toward a slightly-better-informed version of itself, and correct values gradually spread backward from the rewarding states.ε act at random, otherwise take the highest-Q action.ε over time — explore early, exploit once confident.max_a' Q(s', a') — the value of the *best* next action — even if the agent actually took a random exploratory one. So Q-learning learns the optimal policy while *behaving* with a different, exploratory one. That's what 'off-policy' means.Q with a neural network — that's Deep Q-Networks (DQN), the method that learned to play Atari from pixels.