add castling commands

This commit is contained in:
2025-04-14 10:34:54 +02:00
parent 2578e8cf6f
commit 07016be5d8
3 changed files with 62 additions and 2 deletions

View File

@@ -230,7 +230,10 @@ public class ChessBoard {
undoLastMove();
}
return true;
Coordinate rookObstacleCoords = Coordinate.fromIndex(rookCoords.toIndex() - kingDirection.getIndexOffset());
Piece obstacle = pieceAt(rookObstacleCoords);
return obstacle == null;
}
public boolean canSmallCastle(Color color) {