Skip to content

Commit

Permalink
use statScore to adjust futility margin (div 256 clamp 0)
Browse files Browse the repository at this point in the history
test r15
  • Loading branch information
dhbloo committed Jun 14, 2024
1 parent 190b2a1 commit c0570a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Rapfi/search/ab/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ constexpr Value razorMargin(Depth d)

/// Static futility pruning depth & margins
template <Rule R>
constexpr Value futilityMargin(Depth d, bool noTTCutNode, bool improving)
constexpr Value futilityMargin(Depth d, bool noTTCutNode, bool improving, int statScore)
{
constexpr int FutilityScale[RULE_NB] = {63, 61, 78};
return Value(std::max(int((FutilityScale[R] - 13 * noTTCutNode) * (d - improving)), 0));
int margin =
int((FutilityScale[R] - 13 * noTTCutNode) * (d - (1 + improving))) - statScore / 256;
return Value(std::max(margin, 0));
}

/// Null move pruning margin
Expand Down
7 changes: 6 additions & 1 deletion Rapfi/search/ab/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,12 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth
// Step 8. Futility pruning: child node (~70 elo)
if (!PvNode && eval < VALUE_MATE_IN_MAX_PLY // Do not return unproven wins
&& beta > VALUE_MATED_IN_MAX_PLY // Confirm non-losing move exists
&& eval - futilityMargin<Rule>(depth - 1, cutNode && !ttHit, improvement > 0) >= beta
&& eval
- futilityMargin<Rule>(depth,
cutNode && !ttHit,
improvement > 0,
(ss - 1)->statScore)
>= beta
&& !((ss - 2)->moveP4[self] >= E_BLOCK4 && (ss - 4)->moveP4[self] >= E_BLOCK4))
return eval;

Expand Down

0 comments on commit c0570a8

Please sign in to comment.