Explore Library
Code QuizIntermediate

One-Step Q Value

Spot the wrong state index in an action-value computation.

Codejavascript
// Q(s,a) = reward + gamma * V(next state)
function qValue(state, action, model, V, gamma) {
  const { nextState, reward } = model(state, action);
  return reward + gamma * V[state];
}

What is the bug in this action-value calculation?