1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00

Sort PV moves always in two steps

This should fix following issue:

Suppose the search with MultiPVIteration == 0 returns an exact score

move = Nxf4, score = 100

Now search with MultiPVIteration == 1 and get two scores

move = Qg8, score = 150
move = Ra1, score = 180

If we now reorder all the moves in one step we end up with

pv[0] = Ra1, pv[1] = Qg8

Instead reordering as the current patch we end up in:

pv[0] = Ra1, pv[1] = Nxf4

preserving the first searched move.

No functional change in single PV.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-08-02 09:53:56 +01:00
parent 409930e98c
commit c71ae794df

View file

@ -570,13 +570,14 @@ namespace {
// because all the values but the first are usually set to
// -VALUE_INFINITE and we want to keep the same order for all
// the moves but the new PV that goes to head.
if (value > alpha && value < beta)
sort<RootMove>(Rml.begin(), Rml.end());
else
// In MultiPV mode, sort only the tail of the list
// until all fail-highs and fail-lows have been resolved
sort<RootMove>(Rml.begin() + MultiPVIteration, Rml.end());
// In case we have found an exact score reorder the PV moves
// before leaving the fail high/low loop, otherwise leave the
// last PV move in its position so to be searched again.
if (value > alpha && value < beta)
sort<RootMove>(Rml.begin(), Rml.begin() + MultiPVIteration);
// Write PV back to transposition table in case the relevant entries
// have been overwritten during the search.
for (int i = 0; i <= MultiPVIteration; i++)