Learning not to lose before trying to win