refactoring getLegalPawnMoves