Skip to content

Commit 97212ba

Browse files
committed
Use 'moveCount' name also in RootSearch
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
1 parent 07fcc80 commit 97212ba

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/search.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,10 @@ namespace {
716716
rml.sort();
717717

718718
// Step 10. Loop through all moves in the root move list
719-
for (int i = 0; i < (int)rml.size() && !StopRequest; i++)
719+
for (int moveCount = 0; moveCount < (int)rml.size() && !StopRequest; moveCount++)
720720
{
721721
// This is used by time management
722-
FirstRootMove = (i == 0);
722+
FirstRootMove = (moveCount == 0);
723723

724724
// Save the current node count before the move is searched
725725
nodes = pos.nodes_searched();
@@ -736,11 +736,11 @@ namespace {
736736

737737
// Pick the next root move, and print the move and the move number to
738738
// the standard output.
739-
move = ss->currentMove = rml[i].pv[0];
739+
move = ss->currentMove = rml[moveCount].pv[0];
740740

741741
if (current_search_time() >= 1000)
742742
cout << "info currmove " << move
743-
<< " currmovenumber " << i + 1 << endl;
743+
<< " currmovenumber " << moveCount + 1 << endl;
744744

745745
moveIsCheck = pos.move_is_check(move);
746746
captureOrPromotion = pos.move_is_capture_or_promotion(move);
@@ -764,7 +764,7 @@ namespace {
764764
// Step extra. pv search
765765
// We do pv search for first moves (i < MultiPV)
766766
// and for fail high research (value > alpha)
767-
if (i < MultiPV || value > alpha)
767+
if (moveCount < MultiPV || value > alpha)
768768
{
769769
// Aspiration window is disabled in multi-pv case
770770
if (MultiPV > 1)
@@ -784,7 +784,7 @@ namespace {
784784
&& !captureOrPromotion
785785
&& !move_is_castle(move))
786786
{
787-
ss->reduction = reduction<PV>(depth, i - MultiPV + 2);
787+
ss->reduction = reduction<PV>(depth, moveCount - MultiPV + 2);
788788
if (ss->reduction)
789789
{
790790
assert(newDepth-ss->reduction >= ONE_PLY);
@@ -819,11 +819,11 @@ namespace {
819819
// We are failing high and going to do a research. It's important to update
820820
// the score before research in case we run out of time while researching.
821821
ss->bestMove = move;
822-
rml[i].pv_score = value;
823-
rml[i].extract_pv_from_tt(pos);
822+
rml[moveCount].pv_score = value;
823+
rml[moveCount].extract_pv_from_tt(pos);
824824

825825
// Inform GUI that PV has changed
826-
cout << rml[i].pv_info_to_uci(pos, alpha, beta) << endl;
826+
cout << rml[moveCount].pv_info_to_uci(pos, alpha, beta) << endl;
827827

828828
// Prepare for a research after a fail high, each time with a wider window
829829
beta = Min(beta + AspirationDelta * (1 << researchCountFH), VALUE_INFINITE);
@@ -840,32 +840,32 @@ namespace {
840840
break;
841841

842842
// Remember searched nodes counts for this move
843-
rml[i].nodes += pos.nodes_searched() - nodes;
843+
rml[moveCount].nodes += pos.nodes_searched() - nodes;
844844

845845
assert(value >= -VALUE_INFINITE && value <= VALUE_INFINITE);
846846
assert(value < beta);
847847

848848
// Step 17. Check for new best move
849-
if (value <= alpha && i >= MultiPV)
850-
rml[i].pv_score = -VALUE_INFINITE;
849+
if (value <= alpha && moveCount >= MultiPV)
850+
rml[moveCount].pv_score = -VALUE_INFINITE;
851851
else
852852
{
853853
// PV move or new best move!
854854

855855
// Update PV
856856
ss->bestMove = move;
857-
rml[i].pv_score = value;
858-
rml[i].extract_pv_from_tt(pos);
857+
rml[moveCount].pv_score = value;
858+
rml[moveCount].extract_pv_from_tt(pos);
859859

860860
// We record how often the best move has been changed in each
861861
// iteration. This information is used for time managment: When
862862
// the best move changes frequently, we allocate some more time.
863-
if (MultiPV == 1 && i > 0)
863+
if (MultiPV == 1 && moveCount > 0)
864864
BestMoveChangesByIteration[Iteration]++;
865865

866866
// Inform GUI that PV has changed, in case of multi-pv UCI protocol
867867
// requires we send all the PV lines properly sorted.
868-
rml.sort_multipv(i);
868+
rml.sort_multipv(moveCount);
869869

870870
for (int j = 0; j < Min(MultiPV, (int)rml.size()); j++)
871871
cout << rml[j].pv_info_to_uci(pos, alpha, beta, j) << endl;
@@ -878,7 +878,7 @@ namespace {
878878
alpha = value;
879879
}
880880
else // Set alpha equal to minimum score among the PV lines
881-
alpha = rml[Min(i, MultiPV - 1)].pv_score;
881+
alpha = rml[Min(moveCount, MultiPV - 1)].pv_score;
882882

883883
} // PV move or new best move
884884

0 commit comments

Comments
 (0)