]> git.sesse.net Git - stockfish/commitdiff
Retire badCaptures[] array in MovePicker
authorMarco Costalba <mcostalba@gmail.com>
Mon, 13 Sep 2010 07:49:49 +0000 (09:49 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 13 Sep 2010 12:22:00 +0000 (13:22 +0100)
Use the tail of moves[] array to store bad captures.

No functional change but some move reorder. Verified with old perft.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movepick.cpp
src/movepick.h

index b0469a66abd5f08ce6facf8754ea1344f895e887..c2b8924a962a3392e152582e799ff1b90b6a0001 100644 (file)
@@ -75,7 +75,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
   int searchTT = ttm;
   ttMoves[0].move = ttm;
   badCaptureThreshold = 0;
   int searchTT = ttm;
   ttMoves[0].move = ttm;
   badCaptureThreshold = 0;
-  lastBadCapture = badCaptures;
+  badCaptures = moves + 256;
 
   pinned = p.pinned_pieces(pos.side_to_move());
 
 
   pinned = p.pinned_pieces(pos.side_to_move());
 
@@ -148,10 +148,10 @@ void MovePicker::go_next_phase() {
       return;
 
   case PH_BAD_CAPTURES:
       return;
 
   case PH_BAD_CAPTURES:
-      // Bad captures SEE value is already calculated so just sort them
-      // to get SEE move ordering.
+      // Bad captures SEE value is already calculated so just pick
+      // them in order to get SEE move ordering.
       curMove = badCaptures;
       curMove = badCaptures;
-      lastMove = lastBadCapture;
+      lastMove = moves + 256;
       return;
 
   case PH_EVASIONS:
       return;
 
   case PH_EVASIONS:
@@ -292,12 +292,10 @@ Move MovePicker::get_next_move() {
                   if (seeValue >= badCaptureThreshold)
                       return move;
 
                   if (seeValue >= badCaptureThreshold)
                       return move;
 
-                  // Losing capture, move it to the badCaptures[] array, note
+                  // Losing capture, move it to the tail of the array, note
                   // that move has now been already checked for legality.
                   // that move has now been already checked for legality.
-                  assert(int(lastBadCapture - badCaptures) < 63);
-                  lastBadCapture->move = move;
-                  lastBadCapture->score = seeValue;
-                  lastBadCapture++;
+                  (--badCaptures)->move = move;
+                  badCaptures->score = seeValue;
               }
               break;
 
               }
               break;
 
index 4a4610566c711615aa7f39a27631b5cedae18365..1a652d6fd69b44c7ce118a9ff11d07cacf6407b2 100644 (file)
@@ -65,8 +65,8 @@ private:
   MoveStack ttMoves[2], killers[2];
   int badCaptureThreshold, phase;
   const uint8_t* phasePtr;
   MoveStack ttMoves[2], killers[2];
   int badCaptureThreshold, phase;
   const uint8_t* phasePtr;
-  MoveStack *curMove, *lastMove, *lastGoodNonCapture, *lastBadCapture;
-  MoveStack moves[256], badCaptures[64];
+  MoveStack *curMove, *lastMove, *lastGoodNonCapture, *badCaptures;
+  MoveStack moves[256];
 };
 
 
 };