X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=4592ac084ebc56d60a59b83415167bd2f75af146;hp=3eba90d9678b8cd843688f5e00b3648731726fc8;hb=b638f6b0354ea124dc80e5e38189474d34141e2d;hpb=4ef068a506baeec93d8ef992eef3ddb218d5f88e diff --git a/src/search.cpp b/src/search.cpp index 3eba90d9..4592ac08 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008-2009 Marco Costalba + Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -373,6 +373,7 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, // Initialize global search variables StopOnPonderhit = AbortSearch = Quit = AspirationFailLow = false; + MaxSearchTime = AbsoluteMaxSearchTime = ExtraSearchTime = 0; NodesSincePoll = 0; TM.resetNodeCounters(); SearchStartTime = get_system_time(); @@ -440,10 +441,6 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, { TM.set_active_threads(newActiveThreads); init_eval(TM.active_threads()); - // HACK: init_eval() destroys the static castleRightsMask[] array in the - // Position class. The below line repairs the damage. - Position p(pos.to_fen()); - assert(pos.is_ok()); } // Wake up sleeping threads @@ -647,8 +644,6 @@ namespace { // Initialize iteration Iteration++; BestMoveChangesByIteration[Iteration] = 0; - if (Iteration <= 5) - ExtraSearchTime = 0; cout << "info depth " << Iteration << endl; @@ -790,15 +785,17 @@ namespace { EvalInfo ei; StateInfo st; + CheckInfo ci(pos); int64_t nodes; Move move; Depth depth, ext, newDepth; Value value, alpha, beta; bool isCheck, moveIsCheck, captureOrPromotion, dangerous; - int researchCount = 0; + int researchCountFH, researchCountFL; + + researchCountFH = researchCountFL = 0; alpha = *alphaPtr; beta = *betaPtr; - CheckInfo ci(pos); isCheck = pos.is_check(); // Step 1. Initialize node and poll (omitted at root, but I can see no good reason for this, FIXME) @@ -930,8 +927,8 @@ namespace { print_pv_info(pos, ss, alpha, beta, value); // Prepare for a research after a fail high, each time with a wider window - researchCount++; - *betaPtr = beta = Min(beta + AspirationDelta * (1 << researchCount), VALUE_INFINITE); + *betaPtr = beta = Min(beta + AspirationDelta * (1 << researchCountFH), VALUE_INFINITE); + researchCountFH++; } // End of fail high loop @@ -1016,8 +1013,8 @@ namespace { break; // Prepare for a research after a fail low, each time with a wider window - researchCount++; - *alphaPtr = alpha = Max(alpha - AspirationDelta * (1 << researchCount), -VALUE_INFINITE); + *alphaPtr = alpha = Max(alpha - AspirationDelta * (1 << researchCountFL), -VALUE_INFINITE); + researchCountFL++; } // Fail low loop