From db05b1f9f576e80373ca73899df21226fcb4ac8d Mon Sep 17 00:00:00 2001 From: Henri Wiechers Date: Sat, 11 Jan 2014 11:58:09 +0200 Subject: [PATCH] Rename Position::hidden_checkers to check_blockers No functional change. --- src/position.cpp | 13 ++++++++----- src/position.h | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 55a4c4a2..325f3e4d 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -411,11 +411,14 @@ const string Position::pretty(Move move) const { } -/// Position:hidden_checkers() returns a bitboard of all pinned / discovered check -/// pieces, according to the call parameters. Pinned pieces protect our king and -/// discovered check pieces attack the enemy king. - -Bitboard Position::hidden_checkers(Color c, Color kingColor) const { +/// Position::check_blockers() returns a bitboard of all the pieces with color +/// 'c' that are blocking check on the king with color 'kingColor'. A piece +/// blocks a check if removing that piece from the board would result in a +/// position where the king is in check. A check blocking piece can be either a +/// pinned or a discovered check piece, according if its color 'c' is the same +/// or the opposite of 'kingColor'. + +Bitboard Position::check_blockers(Color c, Color kingColor) const { Bitboard b, pinners, result = 0; Square ksq = king_square(kingColor); diff --git a/src/position.h b/src/position.h index f145249c..8fc62c98 100644 --- a/src/position.h +++ b/src/position.h @@ -174,7 +174,7 @@ private: // Helper functions void do_castling(Square kfrom, Square kto, Square rfrom, Square rto); - Bitboard hidden_checkers(Color c, Color kingColor) const; + Bitboard check_blockers(Color c, Color kingColor) const; void put_piece(Square s, Color c, PieceType pt); void remove_piece(Square s, Color c, PieceType pt); void move_piece(Square from, Square to, Color c, PieceType pt); @@ -315,11 +315,11 @@ inline Bitboard Position::checkers() const { } inline Bitboard Position::discovered_check_candidates() const { - return hidden_checkers(sideToMove, ~sideToMove); + return check_blockers(sideToMove, ~sideToMove); } inline Bitboard Position::pinned_pieces(Color c) const { - return hidden_checkers(c, c); + return check_blockers(c, c); } inline bool Position::pawn_passed(Color c, Square s) const { -- 2.39.2