Explore Library
Code QuizIntermediate

Q-Learning Update Rule

Identify the wrong term in this Q-learning temporal-difference update.

Codejavascript
function qLearningUpdate(Q, s, a, r, sNext, alpha, gamma) {
  const maxNext = Math.max(...Q[sNext]);
  Q[s][a] = Q[s][a] + alpha * (r + gamma * maxNext - Q[sNext][a]);
  return Q;
}

What is the bug in this Q-learning update?