initial double step

This commit is contained in:
HP 2025-05-06 15:46:37 +02:00
parent 9e15058fb8
commit ccd3dacaed
1 changed files with 7 additions and 0 deletions

View File

@ -423,6 +423,13 @@ private ArrayList<int[]> computeLegalMoves(Piece piece) {
// Move forward if square is empty
if (isEmpty(x, nextY)) {
moves.add(new int[]{x, nextY});
// Check for first move double step
int startRow = piece.isWhite()? 1:6;
int twoStepsY = y + 2 * dir;
if (y== startRow && isEmpty(x,twoStepsY)) {
moves.add(new int[] {x, twoStepsY});
}
}
// Diagonal capture