void Search::think() {
- static Book book; // Defined static to initialize the PRNG only once
+ static PolyglotBook book; // Defined static to initialize the PRNG only once
Position& pos = RootPosition;
Chess960 = pos.is_chess960();
// Start with a small aspiration window and, in case of fail high/low,
// research with bigger window until not failing high/low anymore.
- do {
+ while (true)
+ {
// Search starts from ss+1 to allow referencing (ss-1). This is
// needed by update gains and ss copy when splitting at Root.
bestValue = search<Root>(pos, ss+1, alpha, beta, depth * ONE_PLY);
else
break;
- assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE);
+ // Search with full window in case we have a win/mate score
+ if (abs(bestValue) >= VALUE_KNOWN_WIN)
+ {
+ alpha = -VALUE_INFINITE;
+ beta = VALUE_INFINITE;
+ }
- } while (abs(bestValue) < VALUE_KNOWN_WIN);
+ assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE);
+ }
}
// Skills: Do we need to pick now the best move ?