fixed index out of bounds exceptions by moving pacMan in a torus