generalized moveUp, moveDown, moveLeft, moveRight for puzzles that are not 3X3