X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=e526885e50252daa058cab86232b5affc8597f82;hb=fb2fdb21d387d35df0f40cc5196cebb4d36ed2ee;hp=b57cc3c7468d83f24fca51883ca6d83e07a5c05e;hpb=31a0d2200c7e8b1db653ba0c033783787259f1e6;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index b57cc3c7..e526885e 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -207,7 +207,7 @@ void Position::from_fen(const string& fen, bool isChess960) { // Various initialisations chess960 = isChess960; - find_checkers(); + st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(opposite_color(sideToMove)); st->key = compute_key(); st->pawnKey = compute_pawn_key(); @@ -493,19 +493,6 @@ bool Position::move_attacks_square(Move m, Square s) const { } -/// Position::find_checkers() computes the checkersBB bitboard, which -/// contains a nonzero bit for each checking piece (0, 1 or 2). It -/// currently works by calling Position::attackers_to, which is probably -/// inefficient. Consider rewriting this function to use the last move -/// played, like in non-bitboard versions of Glaurung. - -void Position::find_checkers() { - - Color us = side_to_move(); - st->checkersBB = attackers_to(king_square(us)) & pieces(opposite_color(us)); -} - - /// Position::pl_move_is_legal() tests whether a pseudo-legal move is legal bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { @@ -1807,7 +1794,7 @@ void Position::flip() { st->epSquare = flip_square(pos.st->epSquare); // Checkers - find_checkers(); + st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(opposite_color(sideToMove)); // Hash keys st->key = compute_key();