]> git.sesse.net Git - stockfish/commitdiff
Rename one variable
authorFauziAkram <fauzi.dabat@hotmail.com>
Fri, 25 Aug 2023 12:42:44 +0000 (15:42 +0300)
committerStéphane Nicolet <cassio@free.fr>
Sun, 3 Sep 2023 07:10:27 +0000 (09:10 +0200)
To enhance code clarity and prevent potential confusion with the
'r' variable assigned to reduction later in the code, this pull
request renames it to 'reductionScale' when we use the same name
in the reduction() function.

Using distinct variable names for separate functions improves code
readability and maintainability.

closes https://github.com/official-stockfish/Stockfish/pull/4765

No functional change

src/search.cpp

index 76d0545ac50bd7f619f88db3785ee6c0f3e4c316..eefe5a3bcf94d3e7febab78fa9155529dd62104b 100644 (file)
@@ -80,8 +80,9 @@ namespace {
   int Reductions[MAX_MOVES]; // [depth or moveNumber]
 
   Depth reduction(bool i, Depth d, int mn, Value delta, Value rootDelta) {
-    int r = Reductions[d] * Reductions[mn];
-    return (r + 1372 - int(delta) * 1073 / int(rootDelta)) / 1024 + (!i && r > 936);
+    int reductionScale = Reductions[d] * Reductions[mn];
+    return  (reductionScale + 1372 - int(delta) * 1073 / int(rootDelta)) / 1024
+          + (!i && reductionScale > 936);
   }
 
   constexpr int futility_move_count(bool improving, Depth depth) {