Prefer out of loop variables in MovePicker::score_captures()
authorMarco Costalba <mcostalba@gmail.com>
Sun, 26 Oct 2008 12:51:12 +0000 (13:51 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 26 Oct 2008 20:30:21 +0000 (21:30 +0100)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movepick.cpp

index 5f170297b2a26c9c9cae15f73a9415d33e0a0645..b115e8ffb1a9c3b9a6a1c6371ffef62067eea3e3 100644 (file)
@@ -210,16 +210,20 @@ void MovePicker::score_captures() {
   // where it is possible to recapture with the hanging piece). Exchanging
   // big pieces before capturing a hanging piece probably helps to reduce
   // the subtree size.
+  Move m;
+  int seeValue;
+
   for (int i = 0; i < numOfMoves; i++)
   {
-      int seeValue = pos.see(moves[i].move);
+      m = moves[i].move;
+      seeValue = pos.see(m);
       if (seeValue >= 0)
       {
-          if (move_promotion(moves[i].move))
+          if (move_promotion(m))
               moves[i].score = QueenValueMidgame;
           else
-              moves[i].score = int(pos.midgame_value_of_piece_on(move_to(moves[i].move)))
-                              -int(pos.type_of_piece_on(move_from(moves[i].move)));
+              moves[i].score = int(pos.midgame_value_of_piece_on(move_to(m)))
+                              -int(pos.type_of_piece_on(move_from(m)));
       } else
           moves[i].score = seeValue;
   }