- if (!givesCheck && lmrDepth < 7 && !ss->inCheck
- && ss->staticEval + 188 + 206 * lmrDepth + PieceValue[pos.piece_on(to_sq(move))]
- + captureHistory[movedPiece][to_sq(move)]
- [type_of(pos.piece_on(to_sq(move)))]
- / 7
- < alpha)
- continue;
+ if (!givesCheck && lmrDepth < 7 && !ss->inCheck)
+ {
+ Piece capturedPiece = pos.piece_on(to_sq(move));
+ int futilityEval =
+ ss->staticEval + 188 + 206 * lmrDepth + PieceValue[capturedPiece]
+ + captureHistory[movedPiece][to_sq(move)][type_of(capturedPiece)] / 7;
+ if (futilityEval < alpha)
+ continue;
+ }