promotion without undo

This commit is contained in:
HP 2025-05-16 10:15:42 +02:00
parent 989df81c07
commit e005026904
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