promotion of marceau brought back
This commit is contained in:
parent
5673e0b874
commit
2c30f157b0
|
|
@ -399,21 +399,18 @@ public class Board implements Cloneable {
|
|||
|
||||
// --- Pawn Promotion Logic (Your existing logic is here and correct for your pawn setup) ---
|
||||
if (pieceToMove.getType() == PieceType.Pawn) {
|
||||
// White pawns start at Y=1, promote at Y=7 (Height-1, assuming Height=8)
|
||||
// Black pawns start at Y=6, promote at Y=0
|
||||
boolean whitePromotes = pieceToMove.isWhite() && (move.getToRow() == this.getHeight() - 1);
|
||||
boolean blackPromotes = !pieceToMove.isWhite() && (move.getToRow() == 0);
|
||||
|
||||
if (whitePromotes || blackPromotes) {
|
||||
if ((pieceToMove.isWhite() && move.getToRow() == 0) || (!pieceToMove.isWhite() && move.getToRow() == 7)) {
|
||||
// Promote the pawn to a queen
|
||||
Piece promotedPiece = makeNewPiece(PieceType.Queen, pieceToMove.isWhite(), move.getToCol(), move.getToRow());
|
||||
pieces.add(promotedPiece);
|
||||
|
||||
// Update turn info
|
||||
turnIsWhite = !turnIsWhite;
|
||||
turnNumber++;
|
||||
this.enPassantVulnerablePawn = null; // Promotion move clears EP vulnerability
|
||||
// this.lastMoveSourceSquare = new int[]{move.getFromCol(), move.getFromRow()}; // For graying out
|
||||
|
||||
// Play move sound if enabled
|
||||
playMoveSound();
|
||||
return; // Move is complete
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -617,4 +614,5 @@ public class Board implements Cloneable {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue