X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=8f38493027b07e9f8c273ae95d73f046ea8026b3;hp=55a4c4a2fa0e0ca56ae6fe3832a2649698ad3963;hb=e5c3effdb1fee10a694e493773e62f433e642406;hpb=262c380c4bf8dcadf07741ec458a9e6565ecf8b4 diff --git a/src/position.cpp b/src/position.cpp index 55a4c4a2..8f384930 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. +/// 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::hidden_checkers(Color c, Color kingColor) const { +Bitboard Position::check_blockers(Color c, Color kingColor) const { Bitboard b, pinners, result = 0; Square ksq = king_square(kingColor); @@ -1074,7 +1077,6 @@ int Position::see(Move m) const { // Add the new entry to the swap list swapList[slIndex] = -swapList[slIndex - 1] + PieceValue[MG][captured]; - ++slIndex; // Locate and remove the next least valuable attacker captured = min_attacker(byTypeBB, to, stmAttackers, occupied, attackers); @@ -1083,10 +1085,9 @@ int Position::see(Move m) const { // Stop before processing a king capture if (captured == KING && stmAttackers) - { - swapList[slIndex++] = QueenValueMg * 16; break; - } + + ++slIndex; } while (stmAttackers);