Skip to content

Commit

Permalink
Merge pull request #61 from SzilBalazs/timeman
Browse files Browse the repository at this point in the history
Time management improvement 
Bench: 2870227
  • Loading branch information
SzilBalazs authored Nov 9, 2022
2 parents 404b8a4 + 080a5cb commit dc27599
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,9 @@ void iterativeDeepening(Position pos, Depth depth, bool uci) {
break;

// We only care about stability if we searched enough depth
if (currDepth >= 12) {
if (currDepth >= 16) {
if (bestMove != bestPV) {
stability -= 6;
stability -= 10;
} else {
if (std::abs(prevScore - score) >= std::max(prevScore / 10, 50)) {
stability -= 4;
Expand Down
4 changes: 2 additions & 2 deletions src/timeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ U64 getTime() {
void initTimeMan(U64 time, U64 inc, U64 movesToGo, U64 moveTime, U64 nodes) {
nodeCount = 0;

movesToGo = movesToGo == 0 ? 15 : movesToGo;
movesToGo = movesToGo == 0 ? 20 : movesToGo + 1;

startedSearch = getTime();
stabilityTime = 0;
Expand All @@ -58,7 +58,7 @@ void initTimeMan(U64 time, U64 inc, U64 movesToGo, U64 moveTime, U64 nodes) {
U64 panicTime = time / (movesToGo + 10) + 2 * inc;
stabilityTime = time / 500;

shouldSearch = std::min(time - MOVE_OVERHEAD, time / (movesToGo + 1) + inc * 3 / 4 - MOVE_OVERHEAD);
shouldSearch = std::min(time - MOVE_OVERHEAD, time / movesToGo + inc * 3 / 4 - MOVE_OVERHEAD);
maxSearch = std::min(time - MOVE_OVERHEAD, shouldSearch + panicTime);
}

Expand Down

0 comments on commit dc27599

Please sign in to comment.