X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=3f367d83bd0218fed704ad6d720d3c0eb2c9a2a9;hp=915e1af25d69ccee4e5faead5f68cf58b14ecd96;hb=1f73a9ed639b6e55b96635c33b249f29ba726145;hpb=ce2845d3334520d07e38750ff481212f092a3ceb diff --git a/src/search.cpp b/src/search.cpp index 915e1af2..3f367d83 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -600,17 +600,17 @@ namespace { Value value, alpha, beta; Move bestMove, easyMove; - // Moves to search are verified and copied - Rml.init(pos, searchMoves); - - // Initialize FIXME move before Rml.init() + // Initialize stuff before a new search + memset(ss, 0, 4 * sizeof(SearchStack)); TT.new_search(); H.clear(); - memset(ss, 0, 4 * sizeof(SearchStack)); *ponderMove = bestMove = easyMove = MOVE_NONE; depth = aspirationDelta = 0; - ss->currentMove = MOVE_NULL; // Hack to skip update_gains() alpha = -VALUE_INFINITE, beta = VALUE_INFINITE; + ss->currentMove = MOVE_NULL; // Hack to skip update_gains() + + // Moves to search are verified and copied + Rml.init(pos, searchMoves); // Handle special case of searching on a mate/stalemate position if (Rml.size() == 0) @@ -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); @@ -680,7 +679,8 @@ namespace { } else break; - } + + } while (abs(value) < VALUE_KNOWN_WIN); // Collect info about search result bestMove = Rml[0].pv[0];