A discrete spacetime model for quantum mechanics