mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-16 23:26:23 +08:00
Introduce CheckInfo struct
Keeps info used to speed-up move_is_check() No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -56,12 +56,25 @@ Score Position::PieceSquareTable[16][64];
|
||||
|
||||
static bool RequestPending = false;
|
||||
|
||||
////
|
||||
//// Functions
|
||||
////
|
||||
|
||||
/// Constructors
|
||||
|
||||
CheckInfo::CheckInfo(const Position& pos) {
|
||||
|
||||
Color us = pos.side_to_move();
|
||||
Color them = opposite_color(us);
|
||||
|
||||
ksq = pos.king_square(them);
|
||||
dc = pos.discovered_check_candidates(us);
|
||||
|
||||
checkSq[PAWN] = pos.attacks_from<PAWN>(ksq, them);
|
||||
checkSq[KNIGHT] = pos.attacks_from<KNIGHT>(ksq);
|
||||
checkSq[BISHOP] = pos.attacks_from<BISHOP>(ksq);
|
||||
checkSq[ROOK] = pos.attacks_from<ROOK>(ksq);
|
||||
checkSq[QUEEN] = checkSq[BISHOP] | checkSq[ROOK];
|
||||
checkSq[KING] = EmptyBoardBB;
|
||||
}
|
||||
|
||||
Position::Position(const Position& pos) {
|
||||
copy(pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user