From: Marco Costalba Date: Wed, 29 Apr 2009 13:53:37 +0000 (+0200) Subject: Fix assignment of pv[0] when creating root move list X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=00a338088564356b46a8b45aa73a1640fadb2fc9;ds=inline Fix assignment of pv[0] when creating root move list It is bogusly assigned from moves[i].move instead of mlist[i].move or equivalently to moves[count].move that it seem more clear to me. Bug is hidden while all the moves are included, in this default case moves[i].move and mlist[i].move are the same variable. Also a bit of cleanup while there. Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index 3ad5423d..67369ad5 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1921,7 +1921,7 @@ namespace { // Constructor RootMove::RootMove() { - nodes = cumulativeNodes = 0ULL; + nodes = cumulativeNodes = ourBeta = theirBeta = 0ULL; } // RootMove::operator<() is the comparison function used when @@ -1957,22 +1957,20 @@ namespace { for (int k = 0; !includeMove && searchMoves[k] != MOVE_NONE; k++) includeMove = (searchMoves[k] == mlist[i].move); - if (includeMove) - { - // Find a quick score for the move - StateInfo st; - SearchStack ss[PLY_MAX_PLUS_2]; - - moves[count].move = mlist[i].move; - moves[count].nodes = 0ULL; - pos.do_move(moves[count].move, st); - moves[count].score = -qsearch(pos, ss, -VALUE_INFINITE, VALUE_INFINITE, - Depth(0), 1, 0); - pos.undo_move(moves[count].move); - moves[count].pv[0] = moves[i].move; - moves[count].pv[1] = MOVE_NONE; // FIXME - count++; - } + if (!includeMove) + continue; + + // Find a quick score for the move + StateInfo st; + SearchStack ss[PLY_MAX_PLUS_2]; + + moves[count].move = mlist[i].move; + pos.do_move(moves[count].move, st); + moves[count].score = -qsearch(pos, ss, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1, 0); + pos.undo_move(moves[count].move); + moves[count].pv[0] = moves[count].move; + moves[count].pv[1] = MOVE_NONE; // FIXME + count++; } sort(); }