From: Joona Kiiski Date: Sun, 18 Jul 2010 21:01:58 +0000 (+0300) Subject: Initialize SearchStack only once at RootMoveList c'tor X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=b5178597bd71c210de9e4245e26153c24fbb2c13 Initialize SearchStack only once at RootMoveList c'tor Just fix current ugly behaviour :-) No functional change Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index ae64c483..20beb23a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -2730,6 +2730,11 @@ namespace { StateInfo st; bool includeAllMoves = (searchMoves[0] == MOVE_NONE); + // Initialize search stack + init_ss_array(ss, PLY_MAX_PLUS_2); + ss[0].init(); + ss[0].eval = VALUE_NONE; + // Generate all legal moves MoveStack* last = generate_moves(pos, mlist); @@ -2745,11 +2750,8 @@ namespace { continue; // Find a quick score for the move - init_ss_array(ss, PLY_MAX_PLUS_2); - ss[0].init(); - ss[0].eval = VALUE_NONE; - ss[0].currentMove = cur->move; pos.do_move(cur->move, st); + ss[0].currentMove = cur->move; moves[count].move = cur->move; moves[count].score = -qsearch(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1); moves[count].pv[0] = cur->move;