- // Quiet best move: update killers, history and countermoves
- if ( bestValue >= beta
- && !pos.capture_or_promotion(bestMove)
- && !inCheck)
- {
- if (ss->killers[0] != bestMove)
- {
- ss->killers[1] = ss->killers[0];
- ss->killers[0] = bestMove;
- }
-
- // Increase history value of the cut-off move and decrease all the other
- // played non-capture moves.
- Value bonus = Value(int(depth) * int(depth));
- History.update(pos.moved_piece(bestMove), to_sq(bestMove), bonus);
- for (int i = 0; i < quietCount - 1; ++i)
- {
- Move m = quietsSearched[i];
- History.update(pos.moved_piece(m), to_sq(m), -bonus);
- }
-
- if (is_ok((ss-1)->currentMove))
- Countermoves.update(pos.piece_on(prevMoveSq), prevMoveSq, bestMove);
- }
+ // Quiet best move: update killers, history, countermoves and followupmoves
+ if (bestValue >= beta && !pos.capture_or_promotion(bestMove) && !inCheck)
+ update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1);