Skip to content

Commit

Permalink
simplify away likelyfaillow
Browse files Browse the repository at this point in the history
Passed STC non-regressive test on r15:
Total/Win/Draw/Lose: 16548 / 6387 / 3953 / 6208
PTNML: 998 / 1380 / 3408 / 1421 / 1067
WinRate: 50.54%
ELO: 3.22[-1.56, 7.94]
LOS: 90.75
LLR: 2.93[-2.94, 2.94]

bench 4187917f
bench (msvc clang) 1baf495f
  • Loading branch information
dhbloo committed Jun 12, 2024
1 parent 561ac0a commit fa863d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
9 changes: 0 additions & 9 deletions Rapfi/search/ab/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,6 @@ constexpr Value failHighMargin(Depth d, int oppo4)
return Value(FHBias[R] + FHScale[R] * int(d) + FHOppo4[R] * bool(oppo4));
}

/// Fail low reduction margin
template <Rule R>
constexpr Value failLowMargin(Depth d)
{
constexpr int FLBias[RULE_NB] = {89, 82, 106};
constexpr int FLScale[RULE_NB] = {58, 54, 45};
return Value(FLBias[R] + int(FLScale[R] * d));
}

// Lookup tables used for move count based pruning, initialized at startup
inline const auto FutilityMC = []() {
std::array<int, MAX_MOVES + 1> MC {0}; // [depth]
Expand Down
10 changes: 2 additions & 8 deletions Rapfi/search/ab/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,11 +925,6 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth
// Indicate cutNode that will probably fail high if current eval is far above beta
bool likelyFailHigh = !PvNode && cutNode && eval >= beta + failHighMargin<Rule>(depth, oppo4);

// Indicate PvNodes that will probably fail low if node was searched with non-PV search
// at depth equal or greater to current depth and result of this search was far below alpha
bool likelyFailLow = PvNode && ttHit && (ttBound & BOUND_UPPER) && ttDepth >= depth
&& ttValue < alpha + failLowMargin<Rule>(depth);

MovePicker mp(Rule,
board,
MovePicker::ExtraArgs<MovePicker::MAIN> {
Expand Down Expand Up @@ -1119,9 +1114,8 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth
// Dynamic reduction based on complexity
r += complexity * complexityReduction<Rule>(trivialMove, importantMove, distract);

// Decrease reduction if position is or has been on the PV and
// the node is not likely to fail low.
if (ss->ttPv && !likelyFailLow)
// Decrease reduction if position is or has been on the PV
if (ss->ttPv)
r -= 1.0f;

// Increase reduction for nodes that does not improve root alpha
Expand Down

0 comments on commit fa863d2

Please sign in to comment.