-
- ss << "\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)) << " ";
-
- return ss.str();
-}
-
-
-/// Position::game_phase() calculates the game phase interpolating total non-pawn
-/// material between endgame and midgame limits.
-
-Phase Position::game_phase() const {
-
- Value npm = st->npMaterial[WHITE] + st->npMaterial[BLACK];
-
- npm = std::max(EndgameLimit, std::min(npm, MidgameLimit));
-
- return Phase(((npm - EndgameLimit) * 128) / (MidgameLimit - EndgameLimit));
-}
-
-
-/// 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;