Skip to content

Commit

Permalink
tune search
Browse files Browse the repository at this point in the history
  • Loading branch information
tryingsomestuff committed Nov 11, 2024
1 parent 4afa14a commit 5102444
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Source/searcherDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bool Searcher::isRep(const Position& p, bool isPV) const {
if (p.fifty < (2 * limit - 1)) return false;
int count = 0;
const Hash h = computeHash(p);
int k = p.halfmoves - 2;
int k = p.halfmoves - 4;
bool irreversible = false;
//std::cout << "***************** " << k << " " << h << " " << GetFEN(p) << std::endl;
// look in stack first
Expand Down
13 changes: 7 additions & 6 deletions Source/searcherPVS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Searcher::depthPolicy( [[maybe_unused]] const Position & p,
//reduction -= pvsData.theirTurn; ///@todo use in capture also ?
//reduction -= isDangerRed || pvsData.isEmergencyDefence;
reduction -= pvsData.isKnownEndGame;
reduction -= 2*pvsData.isAdvancedPawnPush;
}
else if (Move2Type(m) == T_capture){
stats.incr(Stats::sid_lmrcap);
Expand All @@ -280,14 +281,14 @@ Searcher::depthPolicy( [[maybe_unused]] const Position & p,
const Square to = Move2To(m); // ok this is a std capture (no ep)
const int hScore = HISTORY_DIV(SearchConfig::lmrCapHistoryFactor * historyT.historyCap[PieceIdx(p.board_const(Move2From(m)))][to][Abs(p.board_const(to))-1]);
reduction -= std::max(-2,std::min(2, hScore));

// -----------------------
// less reduction
// -----------------------
reduction -= pvsData.pvnode;
//reduction -= pvsData.ttMoveIsCapture;
//reduction -= pvsData.formerPV || pvsData.ttPV;
reduction -= pvsData.improving;
//reduction -= pvsData.ttMoveIsCapture;
reduction -= 2*pvsData.isAdvancedPawnPush;
}

// never extend more than reduce (to avoid search explosion)
Expand Down Expand Up @@ -807,7 +808,7 @@ ScoreType Searcher::pvs(ScoreType alpha,
MiniMove refutation = INVALIDMINIMOVE;

// a depth that take TT depth into account
pvsData.marginDepth = std::max(1, depth - (pvsData.evalScoreIsHashScore ? e.d : 0));
pvsData.marginDepth = std::max(0, depth - (pvsData.evalScoreIsHashScore ? e.d : 0));

// is the reported static eval better than a move before in the search tree ?
// ! be carefull pvsData.improving implies not being in check !
Expand Down Expand Up @@ -990,7 +991,7 @@ ScoreType Searcher::pvs(ScoreType alpha,
((pvsData.bound == TT::B_alpha && e.s < evalScore) || (pvsData.bound == TT::B_beta && e.s > evalScore) || (pvsData.bound == TT::B_exact))) {
evalScore = TT::adjustHashScore(e.s, height);
pvsData.evalScoreIsHashScore = true;
pvsData.marginDepth = std::max(1, depth - (pvsData.evalScoreIsHashScore ? e.d : 0)); // a depth that take TT depth into account
pvsData.marginDepth = std::max(0, depth - (pvsData.evalScoreIsHashScore ? e.d : 0)); // a depth that take TT depth into account
}
}
}
Expand Down Expand Up @@ -1095,7 +1096,7 @@ ScoreType Searcher::pvs(ScoreType alpha,
stats.incr(Stats::sid_singularExtension2);
++extension;
/*
if (score < betaC - 8 * depth && !pvsData.ttMoveIsCapture){
if (score < betaC - 8 * depth && !pvsData.ttMoveIsCapture && extensions <= 6){
stats.incr(Stats::sid_singularExtension6);
++extension;
}
Expand Down Expand Up @@ -1290,7 +1291,7 @@ ScoreType Searcher::pvs(ScoreType alpha,
else {
// reductions & prunings
const bool isPrunable = /*pvsData.isNotPawnEndGame &&*/ !pvsData.isAdvancedPawnPush && !isMateScore(alpha) && !killerT.isKiller(*it, height) && !DynamicConfig::mateFinder;
const bool isReductible = SearchConfig::doLMR && depth >= SearchConfig::lmrMinDepth && /*pvsData.isNotPawnEndGame &&*/ !pvsData.isAdvancedPawnPush && !DynamicConfig::mateFinder;
const bool isReductible = SearchConfig::doLMR && depth >= SearchConfig::lmrMinDepth && /*pvsData.isNotPawnEndGame &&*/ /*!pvsData.isAdvancedPawnPush &&*/ !DynamicConfig::mateFinder;
const bool isPrunableStd = isPrunable && pvsData.isQuiet;
const bool isPrunableStdNoCheck = isPrunableStd && noCheck;
const bool isPrunableCap = isPrunable && Move2Type(*it) == T_capture && noCheck;
Expand Down

0 comments on commit 5102444

Please sign in to comment.