Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide rfp formula into subcomponents #507

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ int AspirationWindowSearch(int prev_eval, int depth, ThreadData* td) {
return score;
}

int futilityMargin(const int depth, const bool improving, const bool canIIR){
return rfpDepthMargin() * depth - rfpImprovingMargin() * improving - rfpIIRMargin() * canIIR;
}

// Negamax alpha beta search
template <bool pvNode>
int Negamax(int alpha, int beta, int depth, const bool cutNode, ThreadData* td, SearchStack* ss) {
Expand Down Expand Up @@ -517,8 +521,8 @@ int Negamax(int alpha, int beta, int depth, const bool cutNode, ThreadData* td,
if ( depth < 10
&& abs(eval) < MATE_FOUND
&& (ttMove == NOMOVE || isTactical(ttMove))
&& eval - rfpMargin() * (depth - improving - canIIR) >= beta)
return eval - rfpMargin() * (depth - improving - canIIR);
&& eval - futilityMargin(depth, improving, canIIR) >= beta)
return eval - futilityMargin(depth, improving, canIIR);

// Null move pruning: If our position is so good that we can give the opponent a free move and still fail high,
// return early. At higher depth we do a reduced search with null move pruning disabled (ie verification search)
Expand Down Expand Up @@ -671,7 +675,7 @@ int Negamax(int alpha, int beta, int depth, const bool cutNode, ThreadData* td,
skipQuiets = true;
}
}
int see_margin = isQuiet ? seeQuietMargin() * lmrDepth : seeNoisyMargin() * lmrDepth * lmrDepth;
int see_margin = isQuiet ? seeQuietMargin() * lmrDepth : seeNoisyMargin() * lmrDepth * lmrDepth;
// See pruning: prune all the moves that have a SEE score that is lower than our threshold
if (!SEE(pos, move, see_margin))
continue;
Expand Down
4 changes: 3 additions & 1 deletion src/tune.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ TUNE_PARAM(nodeTmMultiplier, 183, 80, 250, 8, 0.002)


// Search
TUNE_PARAM(rfpMargin, 79, 40, 200, 10, 0.002)
TUNE_PARAM(rfpDepthMargin, 79, 40, 200, 10, 0.002)
TUNE_PARAM(rfpImprovingMargin, 79, 40, 200, 10, 0.002)
TUNE_PARAM(rfpIIRMargin, 79, 40, 200, 10, 0.002)
TUNE_PARAM(nmpReductionEvalDivisor, 195, 100, 400, 20, 0.002)
TUNE_PARAM(razoringCoeff, 243, 100, 400, 20, 0.002)
TUNE_PARAM(historyQuietLmrDivisor, 8177, 1, 16383, 100, 0.002)
Expand Down