1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Retire find_checkers()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-06-28 18:01:51 +01:00
parent 31a0d2200c
commit fb2fdb21d3
2 changed files with 2 additions and 16 deletions

View file

@ -207,7 +207,7 @@ void Position::from_fen(const string& fen, bool isChess960) {
// Various initialisations // Various initialisations
chess960 = isChess960; chess960 = isChess960;
find_checkers(); st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(opposite_color(sideToMove));
st->key = compute_key(); st->key = compute_key();
st->pawnKey = compute_pawn_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 /// Position::pl_move_is_legal() tests whether a pseudo-legal move is legal
bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { 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); st->epSquare = flip_square(pos.st->epSquare);
// Checkers // Checkers
find_checkers(); st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(opposite_color(sideToMove));
// Hash keys // Hash keys
st->key = compute_key(); st->key = compute_key();

View file

@ -252,7 +252,6 @@ private:
void do_capture_move(Key& key, PieceType capture, Color them, Square to, bool ep); void do_capture_move(Key& key, PieceType capture, Color them, Square to, bool ep);
void do_castle_move(Move m); void do_castle_move(Move m);
void undo_castle_move(Move m); void undo_castle_move(Move m);
void find_checkers();
template<bool FindPinned> template<bool FindPinned>
Bitboard hidden_checkers(Color c) const; Bitboard hidden_checkers(Color c) const;