+ // Decrease all the other played quiet moves
+ for (int i = 0; i < quietsCnt; ++i)
+ {
+ History.update(pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus);
+
+ if (is_ok((ss-1)->currentMove))
+ cmh.update(pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus);
+ }
+
+ // Extra penalty for TT move in previous ply when it gets refuted
+ if (is_ok((ss-2)->currentMove) && (ss-1)->currentMove == (ss-1)->ttMove)
+ {
+ Square prevPrevSq = to_sq((ss-2)->currentMove);
+ HistoryStats& ttMoveCmh = CounterMovesHistory[pos.piece_on(prevPrevSq)][prevPrevSq];
+ ttMoveCmh.update(pos.piece_on(prevSq), prevSq, -bonus - 2 * depth / ONE_PLY - 1);
+ }
+ }
+
+
+ // When playing with strength handicap, choose best move among a set of RootMoves
+ // using a statistical rule dependent on 'level'. Idea by Heinz van Saanen.
+
+ Move Skill::pick_best(size_t multiPV) {
+
+ // PRNG sequence should be non-deterministic, so we seed it with the time at init
+ static PRNG rng(now());