1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 09:39:36 +00:00

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 <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-04-29 15:53:37 +02:00
parent f1d982e2c0
commit 00a3380885

View file

@ -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];
if (!includeMove)
continue;
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++;
}
// 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();
}