Explore Library
Code QuizIntermediate

SARSA Update Rule

Find why this 'SARSA' update actually behaves like Q-learning.

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

This is meant to be SARSA. What is the bug?