- return false;
- }
-
-
- // yields_to_threat() tests whether the move at previous ply yields to the so
- // called threat move (the best move returned from a null search that fails
- // low). Here 'yields to' means that the move somehow made the threat possible
- // for instance if the moving piece is the same in both moves.
-
- bool yields_to_threat(const Position& pos, Move move, Move threat) {
-
- assert(is_ok(move));
- assert(is_ok(threat));
-
- Square t1 = to_sq(move);
- Square f1 = from_sq(move);
- Square t2 = to_sq(threat);
- Square f2 = from_sq(threat);
-
- // We are suposed to be called upon returning from a null search
- assert(color_of(pos.piece_on(f2)) == ~pos.side_to_move());
-
- // The piece is the same or threat's destination was vacated by the move
- if (t1 == f2 || t2 == f1)
- return true;
-
- // Threat moves through the vacated square
- if (between_bb(f2, t2) & f1)
- return true;
-
- // Threat's destination is defended by the move's piece
- Bitboard t1_att = pos.attacks_from(pos.piece_on(t1), t1, pos.pieces() ^ f2);
- if (t1_att & t2)
- return true;
-
- // Threat gives a discovered check through the move's checking piece
- if (t1_att & pos.king_square(pos.side_to_move()))
+ // Increase history value of the cut-off move and decrease all the other
+ // played quiet moves.
+ Value bonus = Value(int(depth) * int(depth));
+ History.update(pos.moved_piece(move), to_sq(move), bonus);
+ for (int i = 0; i < quietsCnt; ++i)