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

Use 'moveCount' name also in RootSearch

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-01-04 11:35:54 +01:00
parent 07fcc8076d
commit 97212bafc9

View file

@ -716,10 +716,10 @@ namespace {
rml.sort(); rml.sort();
// Step 10. Loop through all moves in the root move list // Step 10. Loop through all moves in the root move list
for (int i = 0; i < (int)rml.size() && !StopRequest; i++) for (int moveCount = 0; moveCount < (int)rml.size() && !StopRequest; moveCount++)
{ {
// This is used by time management // This is used by time management
FirstRootMove = (i == 0); FirstRootMove = (moveCount == 0);
// Save the current node count before the move is searched // Save the current node count before the move is searched
nodes = pos.nodes_searched(); nodes = pos.nodes_searched();
@ -736,11 +736,11 @@ namespace {
// Pick the next root move, and print the move and the move number to // Pick the next root move, and print the move and the move number to
// the standard output. // the standard output.
move = ss->currentMove = rml[i].pv[0]; move = ss->currentMove = rml[moveCount].pv[0];
if (current_search_time() >= 1000) if (current_search_time() >= 1000)
cout << "info currmove " << move cout << "info currmove " << move
<< " currmovenumber " << i + 1 << endl; << " currmovenumber " << moveCount + 1 << endl;
moveIsCheck = pos.move_is_check(move); moveIsCheck = pos.move_is_check(move);
captureOrPromotion = pos.move_is_capture_or_promotion(move); captureOrPromotion = pos.move_is_capture_or_promotion(move);
@ -764,7 +764,7 @@ namespace {
// Step extra. pv search // Step extra. pv search
// We do pv search for first moves (i < MultiPV) // We do pv search for first moves (i < MultiPV)
// and for fail high research (value > alpha) // and for fail high research (value > alpha)
if (i < MultiPV || value > alpha) if (moveCount < MultiPV || value > alpha)
{ {
// Aspiration window is disabled in multi-pv case // Aspiration window is disabled in multi-pv case
if (MultiPV > 1) if (MultiPV > 1)
@ -784,7 +784,7 @@ namespace {
&& !captureOrPromotion && !captureOrPromotion
&& !move_is_castle(move)) && !move_is_castle(move))
{ {
ss->reduction = reduction<PV>(depth, i - MultiPV + 2); ss->reduction = reduction<PV>(depth, moveCount - MultiPV + 2);
if (ss->reduction) if (ss->reduction)
{ {
assert(newDepth-ss->reduction >= ONE_PLY); assert(newDepth-ss->reduction >= ONE_PLY);
@ -819,11 +819,11 @@ namespace {
// We are failing high and going to do a research. It's important to update // We are failing high and going to do a research. It's important to update
// the score before research in case we run out of time while researching. // the score before research in case we run out of time while researching.
ss->bestMove = move; ss->bestMove = move;
rml[i].pv_score = value; rml[moveCount].pv_score = value;
rml[i].extract_pv_from_tt(pos); rml[moveCount].extract_pv_from_tt(pos);
// Inform GUI that PV has changed // Inform GUI that PV has changed
cout << rml[i].pv_info_to_uci(pos, alpha, beta) << endl; cout << rml[moveCount].pv_info_to_uci(pos, alpha, beta) << endl;
// Prepare for a research after a fail high, each time with a wider window // Prepare for a research after a fail high, each time with a wider window
beta = Min(beta + AspirationDelta * (1 << researchCountFH), VALUE_INFINITE); beta = Min(beta + AspirationDelta * (1 << researchCountFH), VALUE_INFINITE);
@ -840,32 +840,32 @@ namespace {
break; break;
// Remember searched nodes counts for this move // Remember searched nodes counts for this move
rml[i].nodes += pos.nodes_searched() - nodes; rml[moveCount].nodes += pos.nodes_searched() - nodes;
assert(value >= -VALUE_INFINITE && value <= VALUE_INFINITE); assert(value >= -VALUE_INFINITE && value <= VALUE_INFINITE);
assert(value < beta); assert(value < beta);
// Step 17. Check for new best move // Step 17. Check for new best move
if (value <= alpha && i >= MultiPV) if (value <= alpha && moveCount >= MultiPV)
rml[i].pv_score = -VALUE_INFINITE; rml[moveCount].pv_score = -VALUE_INFINITE;
else else
{ {
// PV move or new best move! // PV move or new best move!
// Update PV // Update PV
ss->bestMove = move; ss->bestMove = move;
rml[i].pv_score = value; rml[moveCount].pv_score = value;
rml[i].extract_pv_from_tt(pos); rml[moveCount].extract_pv_from_tt(pos);
// We record how often the best move has been changed in each // We record how often the best move has been changed in each
// iteration. This information is used for time managment: When // iteration. This information is used for time managment: When
// the best move changes frequently, we allocate some more time. // the best move changes frequently, we allocate some more time.
if (MultiPV == 1 && i > 0) if (MultiPV == 1 && moveCount > 0)
BestMoveChangesByIteration[Iteration]++; BestMoveChangesByIteration[Iteration]++;
// Inform GUI that PV has changed, in case of multi-pv UCI protocol // Inform GUI that PV has changed, in case of multi-pv UCI protocol
// requires we send all the PV lines properly sorted. // requires we send all the PV lines properly sorted.
rml.sort_multipv(i); rml.sort_multipv(moveCount);
for (int j = 0; j < Min(MultiPV, (int)rml.size()); j++) for (int j = 0; j < Min(MultiPV, (int)rml.size()); j++)
cout << rml[j].pv_info_to_uci(pos, alpha, beta, j) << endl; cout << rml[j].pv_info_to_uci(pos, alpha, beta, j) << endl;
@ -878,7 +878,7 @@ namespace {
alpha = value; alpha = value;
} }
else // Set alpha equal to minimum score among the PV lines else // Set alpha equal to minimum score among the PV lines
alpha = rml[Min(i, MultiPV - 1)].pv_score; alpha = rml[Min(moveCount, MultiPV - 1)].pv_score;
} // PV move or new best move } // PV move or new best move