And Panderson, at Zama the roman infantry line was very very close of the breaking point when the cavalry came back and decisively turned the course of the battle in favor of the romans. Scipio and his lieutenants executed well, but many great generals were defeated because their plan was not executed as planned.
Are you sure that everything was an Hannibal's trap? Can't we say that after the elephant charge everything went wrong for Hannibal instead? The Romans had defeated two of the Carthaginians lines already when the cavalry came back