Explore Library
Code QuizIntermediate

TD(0) Value Update

Find the mistake in this TD(0) state-value update step.

Codepython
def td0_update(V, state, next_state, reward, alpha, gamma):
    td_target = reward + gamma * V[next_state]
    td_error = td_target - V[state]
    V[next_state] = V[next_state] + alpha * td_error
    return V

What is the bug in this TD(0) update?