X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=d94128eb41c944bd34ec5d92432aad714e5efce5;hp=5a0af8f82a0700cea2a8515b414d823b8e9ae3e9;hb=76506bd3d10214aa3f3d12dad60e8da729fc318c;hpb=af236373cb8d118902a2cd14c741c7e9e6828ba8 diff --git a/src/search.cpp b/src/search.cpp index 5a0af8f8..d94128eb 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -596,7 +596,7 @@ namespace { SearchStack ss[PLY_MAX_PLUS_2]; Value bestValues[PLY_MAX_PLUS_2]; int bestMoveChanges[PLY_MAX_PLUS_2]; - int depth, researchCountFL, researchCountFH, aspirationDelta; + int depth, aspirationDelta; Value value, alpha, beta; Move bestMove, easyMove; @@ -625,7 +625,7 @@ namespace { // Iterative deepening loop while (++depth <= PLY_MAX && (!MaxDepth || depth <= MaxDepth) && !StopRequest) { - Rml.bestMoveChanges = researchCountFL = researchCountFH = 0; + Rml.bestMoveChanges = 0; cout << "info depth " << depth << endl; // Calculate dynamic aspiration window based on previous iterations @@ -643,8 +643,7 @@ namespace { // Start with a small aspiration window and, in case of fail high/low, // research with bigger window until not failing high/low anymore. - while (true) - { + do { // Search starting from ss+1 to allow calling update_gains() value = search(pos, ss+1, alpha, beta, depth * ONE_PLY, 0); @@ -667,20 +666,21 @@ namespace { // otherwise exit the fail high/low loop. if (value >= beta) { - beta = Min(beta + aspirationDelta * (1 << researchCountFH), VALUE_INFINITE); - researchCountFH++; + beta = Min(beta + aspirationDelta, VALUE_INFINITE); + aspirationDelta += aspirationDelta / 2; } else if (value <= alpha) { AspirationFailLow = true; StopOnPonderhit = false; - alpha = Max(alpha - aspirationDelta * (1 << researchCountFL), -VALUE_INFINITE); - researchCountFL++; + alpha = Max(alpha - aspirationDelta, -VALUE_INFINITE); + aspirationDelta += aspirationDelta / 2; } else break; - } + + } while (abs(value) < VALUE_KNOWN_WIN); // Collect info about search result bestMove = Rml[0].pv[0];