Code: Select all
// move properties for reduction decision
const bool is_first = msl.idx == 1;
const bool is_capture = move_is_cop(ms->m);
const bool is_bad_see = ms->see < 0;
const int hscore = get_history(B, ms->m);
// reduction decision
const bool is_bad_capture = is_capture && is_bad_see;
const bool is_bad_quiet = !is_capture && (hscore < 0 || (hscore == 0 && is_bad_see));
const bool reduce = !is_first && (is_bad_capture || is_bad_quiet);
// reduced PVS
if (!is_pv || is_first)
// search full window
score = -search(B, -beta, -alpha, new_depth-reduce, ply+1, is_pv, si+1);
else /* if (is_pv && !is_first) */ {
// try zero window first
score = -search(B, -alpha-1, -alpha, new_depth-reduce, ply+1, false, si+1);
if (score > alpha)
score = -search(B, -beta, -alpha, new_depth-reduce, ply+1, true, si+1);
}
// verify LMR predicted beta cutoffs at PV nodes
if (reduce && is_pv && score >= beta)
score = -search(B, -beta, -alpha, new_depth, ply+1, is_pv, si+1);
* captures with >= 0 SEE. In other words, bad captures are reduced, others aren't. In a way this also encompasses a kind of recapture extension, in the sense that recaptures (see > 0) are not reduced which, comparatively to bad captures, is an extension.
* non-captures are considered bad when
- they have a < 0 history score
- they have a zero history score, but a < 0 see. Indeed a quiet move, such as just putting a piece "en-prise", if it hasn't been searched before may not have an history score, but is generally a blunder when it has an see < 0.
* bad non-captures are reduced
* obviously the first move is not reduced, and there's a min depth condiotion,
Then I do a classical PVS with reduced depth. If a beta cutoff is predicted, I do a non-reduced verification search. The verification search should be rather fast because the reduced search has prepared the hash table, so at least the move ordering will perform well on that subtree.
I'm wondering if all that makes sense, and whether I should do PV dependant conditions such as:
* reduce after the i-th move where i is different for PV and non PV nodes
* do the verification search only at PV nodes
As usual, thoughts and constructive comments are welcome!
Thank you