@@ -61,7 +61,7 @@ using chess::WinUtility;
6161
6262constexpr int kNumReversibleMovesToDraw = 100 ;
6363constexpr int kNumRepetitionsToDraw = 3 ;
64- // Standard chess start position; atomic chess keeps castling rights .
64+ // Standard chess start position.
6565inline const std::string kDefaultStandardFEN =
6666 " rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" ;
6767
@@ -79,27 +79,20 @@ inline Color OtherColor(Color c) {
7979 return c == Color::kWhite ? Color::kBlack : Color::kWhite ;
8080}
8181
82- // True if `move` is an en passant capture on `board` (a pawn moving to the
83- // current en passant target square, which is empty).
8482bool IsEnPassant (const ChessBoard& board, const Move& move) {
8583 return move.piece .type == PieceType::kPawn &&
8684 board.EpSquare () != kInvalidSquare && move.to == board.EpSquare ();
8785}
8886
89- // True if `move` captures a piece on `board` (including en passant).
87+ // check if kabloom should happen
9088bool IsCapture (const ChessBoard& board, const Move& move) {
9189 return board.at (move.to ).type != PieceType::kEmpty ||
9290 IsEnPassant (board, move);
9391}
9492
9593// Revokes any castling right whose rook is no longer standing on its recorded
96- // castling square. ChessBoard::ApplyMove only clears a castling right when the
97- // rook is the direct capture target; an explosion removes rooks via set_square
98- // on the surrounding squares, which bypasses that bookkeeping. Without this the
99- // right outlives its rook, which (a) makes ToFEN() and the Zobrist hash
100- // disagree with the actual position, and (b) if a friendly non-rook piece later
101- // occupies the vacated corner, lets the board generate a castle that fabricates
102- // a phantom rook.
94+ // castling square.
95+
10396void RevokeCastlingForMissingRooks (ChessBoard* board) {
10497 for (Color color : {Color::kWhite , Color::kBlack }) {
10598 for (chess::CastlingDirection dir :
@@ -143,7 +136,7 @@ void ApplyExplosion(ChessBoard* board, const Move& move, bool was_en_passant) {
143136 RevokeCastlingForMissingRooks (board);
144137}
145138
146- // True if the two kings are on adjacent squares (Chebyshev distance 1) .
139+ // Checks if the two kings are on adjacent squares.
147140bool KingsAdjacent (const ChessBoard& board) {
148141 Square wk = board.find (Piece{Color::kWhite , PieceType::kKing });
149142 Square bk = board.find (Piece{Color::kBlack , PieceType::kKing });
@@ -161,7 +154,7 @@ bool InAtomicCheck(const ChessBoard& board, Color color) {
161154 return board.UnderAttack (ksq, color);
162155}
163156
164- // Returns true if `color`'s king is not on the board (was exploded).
157+ // Checks if king went kabloom
165158bool KingMissing (const ChessBoard& board, Color color) {
166159 return !board.InBoardArea (board.find (Piece{color, PieceType::kKing }));
167160}
0 commit comments