Apply LMR after move 10#442
Conversation
WalkthroughModified null-move pruning strategy in Searcher::pvs by adding positional-weight-based condition checks, implementing late-move reduction, and optimizing hash-move lookup through caching. The null-move recommendation logic was simplified by removing an explicit guard clause. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #442 +/- ##
=====================================
+ Coverage 92% 92% +1%
=====================================
Files 33 33
Lines 3757 3760 +3
Branches 3757 3760 +3
=====================================
+ Hits 3419 3422 +3
Misses 319 319
Partials 19 19 🚀 New features to boost your workflow:
|
|
Against master [hash=64]: 🆗 Elo: 39.43 +/- 17.59, nElo: 48.72 +/- 21.53 |
|
Against v1.6.0 [hash=64]: ✅ Elo: 62.87 +/- 18.64, nElo: 74.28 +/- 21.53 |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/search/mod.rs (1)
217-247: 🧹 Nitpick | 🔵 TrivialLMR is unconditional on move kind — consider gating on
mov.is_quiet().
may_late_move_reduce = !is_frontier_node && !interestingcombined withi >= 10applies the reduction uniformly to whateverMovePickeremits at that index, including captures (good or bad) and promotions. By move 10 the picker is usually past good captures into killers/quiets/bad-captures, so in practice this is mostly safe — but in high-mobility middlegames with many legal captures, a tactically significant capture can legitimately appear at index ≥ 10 and get reduced.The conventional LMR formulation restricts the reduction to quiet, non-check, non-promotion moves, which is cheap to evaluate and removes the tactical risk entirely. Given the reduction is only 1 ply the risk here is modest, but this is worth either gating explicitly or validating with a tactical-suite run.
♻️ Suggested gating
- let may_late_move_reduce = !is_frontier_node && !interesting; + let may_late_move_reduce = !is_frontier_node && !interesting; @@ - let reduction = if may_late_move_reduce && i >= 10 { 1 } else { 0 }; + let reduction = if may_late_move_reduce && i >= 10 && mov.is_quiet() { + 1 + } else { + 0 + };Note: the parallel change at line 243 — dropping
!window.cuts_off(null_score)and re-searching wheneverimproves(null_score)— is correct and in fact required by LMR: a reduced-depth null-window fail-high must be verified at full depth before being trusted, so the old short-circuit would have been unsound here.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 896ce659-a1ef-4981-bdcb-f0113592a4eb
📒 Files selected for processing (1)
src/search/mod.rs
Summary by CodeRabbit