test promotion
This commit is contained in:
parent
216d7cf153
commit
dd8b55e2a3
|
|
@ -404,18 +404,16 @@ public class Board implements Cloneable {
|
|||
// Remove the piece from its original location
|
||||
pieces.remove(pieceToMove);
|
||||
|
||||
// --- Pawn Promotion Logic (Your existing logic is here and correct for your pawn setup) ---
|
||||
|
||||
if (pieceToMove.getType() == PieceType.Pawn) {
|
||||
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++;
|
||||
|
||||
// Play move sound if enabled
|
||||
playMoveSound();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
BR,BN,BB,BQ,BK,BB,BN,BR
|
||||
,BP,BP,BP,BP,BP,WP,BP
|
||||
,,,,,,,
|
||||
,,,,,,,
|
||||
,,,,,,,
|
||||
,,,,,,,
|
||||
WP,BP,WP,WP,WP,WP,WP,
|
||||
WR,WN,WB,WQ,WK,WB,WN,WR
|
||||
W
|
||||
Loading…
Reference in New Issue