rv.add(BitBoard.generateDoubleAdvanceMove(
nextPawn, shiftStrategy.shiftForward(nextPawn, 2), playerIdx));
}
}
} else {
BitBoardMove bbMove = BitBoard.generateMove(nextPawn, toSquare, playerIdx, Piece.PAWN);
bitBoard.makeMove(bbMove);
if (!CheckDetector.isPlayerJustMovedInCheck(bitBoard, !alreadyInCheck)) {
if ((toSquare & BitBoard.FINAL_RANKS) != 0) {
rv.addAll(BitBoard.generatePromotions(nextPawn, toSquare, playerIdx));
} else {
rv.add(bbMove);
}
}
bitBoard.unmakeMove();
if(doubleMove) {
BitBoardMove pushTwo = BitBoard.generateDoubleAdvanceMove(
nextPawn, shiftStrategy.shiftForward(nextPawn, 2), playerIdx);
bitBoard.makeMove(pushTwo);
if(!CheckDetector.isPlayerJustMovedInCheck(bitBoard, !alreadyInCheck)) {
rv.add(pushTwo);
}