+ Value bonus = Value((depth / ONE_PLY) * (depth / ONE_PLY) + 2 * depth / ONE_PLY - 2);
+ Square prevSq = to_sq((ss-1)->currentMove);
+
+ // Extra penalty for a quiet TT move in previous ply when it gets refuted
+ if ((ss-1)->moveCount == 1 && !pos.captured_piece_type())
+ {
+ CounterMoveStats* fmh = (ss-2)->counterMoves;
+ CounterMoveStats* cmh2 = (ss-3)->counterMoves;
+ CounterMoveStats* cmh3 = (ss-5)->counterMoves;
+
+ if (fmh)
+ fmh->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY - 1);
+
+ if (cmh2)
+ cmh2->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY - 1);
+
+ if (cmh3)
+ cmh3->update(pos.piece_on(prevSq), prevSq, -bonus - 2 * (depth + 1) / ONE_PLY - 1);
+ }
+
+ if (pos.capture_or_promotion(move))
+ return;
+