promotion without undo

This commit is contained in:
HP 2025-05-16 10:31:31 +02:00
parent 85258bb365
commit 0d0686b323
1 changed files with 8 additions and 0 deletions

View File

@ -460,6 +460,14 @@ public ArrayList<int[]> computeLegalMoves(Piece piece) {
if (y == startRow && isEmpty(x, twoStepsY)) { if (y == startRow && isEmpty(x, twoStepsY)) {
moves.add(new int[]{x, twoStepsY}); moves.add(new int[]{x, twoStepsY});
} }
if (nextY == 7 ){
setPiece(false , PieceType.Queen, x,nextY);
pieces.remove(piece);
}
if (nextY==0 ){
setPiece(true , PieceType.Queen, x,nextY);
pieces.remove(piece);
}
} }
// Diagonal capture // Diagonal capture