diff --git a/src/bitboard.cpp b/src/bitboard.cpp index ae653b1c211..7687cbb4441 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -45,6 +45,7 @@ Bitboard AdjacentFilesBB[FILE_NB]; Bitboard InFrontBB[COLOR_NB][RANK_NB]; Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB]; Bitboard BetweenBB[SQUARE_NB][SQUARE_NB]; +Bitboard LineBB[SQUARE_NB][SQUARE_NB]; Bitboard DistanceRingsBB[SQUARE_NB][8]; Bitboard ForwardBB[COLOR_NB][SQUARE_NB]; Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB]; @@ -225,6 +226,9 @@ void Bitboards::init() { for (Square s = s1 + delta; s != s2; s += delta) BetweenBB[s1][s2] |= s; + + PieceType pc = (PseudoAttacks[BISHOP][s1] & s2) ? BISHOP : ROOK; + LineBB[s1][s2] = (PseudoAttacks[pc][s1] & PseudoAttacks[pc][s2]) | s1 | s2; } } diff --git a/src/bitboard.h b/src/bitboard.h index 3afbeedfbab..deba91d5412 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -74,6 +74,7 @@ extern Bitboard AdjacentFilesBB[FILE_NB]; extern Bitboard InFrontBB[COLOR_NB][RANK_NB]; extern Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB]; extern Bitboard BetweenBB[SQUARE_NB][SQUARE_NB]; +extern Bitboard LineBB[SQUARE_NB][SQUARE_NB]; extern Bitboard DistanceRingsBB[SQUARE_NB][8]; extern Bitboard ForwardBB[COLOR_NB][SQUARE_NB]; extern Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB]; diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 27980238740..dd719554e18 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -492,7 +492,7 @@ Value do_evaluate(const Position& pos) { : pos.attacks_from(s); if (ei.pinnedPieces[Us] & s) - b &= PseudoAttacks[QUEEN][pos.king_square(Us)]; + b &= LineBB[pos.king_square(Us)][s]; ei.attackedBy[Us][Piece] |= b;