@@ -69,6 +69,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist
6969
7070 stage = (pos.checkers () ? EVASION_TT : MAIN_TT) +
7171 !(ttm && pos.pseudo_legal (ttm));
72+ threatenedPieces = 0 ;
7273}
7374
7475// / MovePicker constructor for quiescence search
@@ -106,21 +107,19 @@ void MovePicker::score() {
106107
107108 static_assert (Type == CAPTURES || Type == QUIETS || Type == EVASIONS, " Wrong type" );
108109
109- [[maybe_unused]] Bitboard threatened, threatenedByPawn, threatenedByMinor, threatenedByRook;
110+ [[maybe_unused]] Bitboard threatenedByPawn, threatenedByMinor, threatenedByRook;
110111 if constexpr (Type == QUIETS)
111112 {
112113 Color us = pos.side_to_move ();
113- // squares threatened by pawns
114+
114115 threatenedByPawn = pos.attacks_by <PAWN>(~us);
115- // squares threatened by minors or pawns
116116 threatenedByMinor = pos.attacks_by <KNIGHT>(~us) | pos.attacks_by <BISHOP>(~us) | threatenedByPawn;
117- // squares threatened by rooks, minors or pawns
118117 threatenedByRook = pos.attacks_by <ROOK>(~us) | threatenedByMinor;
119118
120- // pieces threatened by pieces of lesser material value
121- threatened = (pos.pieces (us, QUEEN) & threatenedByRook)
122- | (pos.pieces (us, ROOK) & threatenedByMinor)
123- | (pos.pieces (us, KNIGHT, BISHOP) & threatenedByPawn);
119+ // Pieces threatened by pieces of lesser material value
120+ threatenedPieces = (pos.pieces (us, QUEEN) & threatenedByRook)
121+ | (pos.pieces (us, ROOK) & threatenedByMinor)
122+ | (pos.pieces (us, KNIGHT, BISHOP) & threatenedByPawn);
124123 }
125124
126125 for (auto & m : *this )
@@ -134,7 +133,7 @@ void MovePicker::score() {
134133 + (*continuationHistory[1 ])[pos.moved_piece (m)][to_sq (m)]
135134 + (*continuationHistory[3 ])[pos.moved_piece (m)][to_sq (m)]
136135 + (*continuationHistory[5 ])[pos.moved_piece (m)][to_sq (m)]
137- + (threatened & from_sq (m) ?
136+ + (threatenedPieces & from_sq (m) ?
138137 (type_of (pos.moved_piece (m)) == QUEEN && !(to_sq (m) & threatenedByRook) ? 50000
139138 : type_of (pos.moved_piece (m)) == ROOK && !(to_sq (m) & threatenedByMinor) ? 25000
140139 : !(to_sq (m) & threatenedByPawn) ? 15000
0 commit comments