-
- std::ostringstream ss;
-
- if (move)
- ss << "\nMove: " << (sideToMove == BLACK ? ".." : "")
- << move_to_san(*const_cast<Position*>(this), move);
-
- ss << brd << "\nFen: " << fen() << "\nKey: " << std::hex << std::uppercase
- << std::setfill('0') << std::setw(16) << st->key << "\nCheckers: ";
-
- for (Bitboard b = checkers(); b; )
- ss << to_string(pop_lsb(&b)) << " ";
-
- ss << "\nLegal moves: ";
- for (MoveList<LEGAL> it(*this); *it; ++it)
- ss << move_to_san(*const_cast<Position*>(this), *it) << " ";
-
- return ss.str();
-}
-
-
-/// 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);
-
- // Pinners are sliders that give check when a pinned piece is removed
- pinners = ( (pieces( ROOK, QUEEN) & PseudoAttacks[ROOK ][ksq])
- | (pieces(BISHOP, QUEEN) & PseudoAttacks[BISHOP][ksq])) & pieces(~kingColor);
-
- while (pinners)
- {
- b = between_bb(ksq, pop_lsb(&pinners)) & pieces();
-
- if (!more_than_one(b))
- result |= b & pieces(c);
- }
- return result;