Refactor movePiece into getNewLocation