Reinforcement learning learns from rewards instead of labelled answers. Q-learning keeps a table Q(s, a), the reward it expects from making move a in state s and acting well afterwards. After every move it nudges that entry towards r + γ·max Q(s′, ·): the reward it just got plus the discounted value of the best move from where it landed. Mostly it makes the move with the largest Q-value; with chance ε it tries a random one, so it keeps discovering.