]> git.sesse.net Git - stockfish/commitdiff
Order bad captures by MVV/LVA
authorMarco Costalba <mcostalba@gmail.com>
Sat, 21 Jan 2012 19:53:42 +0000 (20:53 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 24 Jan 2012 06:12:19 +0000 (07:12 +0100)
Instead of by SEE. Almost no ELO change but it is
a bit easier and is a more natural choice given
that good captures are ordered in the same way.

After 10424 games
Mod vs Orig 1639 - 1604 - 7181 ELO +1 (+-3.8)

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

index 486fec0fbe3177f0e871723f7be8872488ed1b8f..37775faa33aa666e8b0bea1b4eb9e9d23cee2690 100644 (file)
@@ -64,7 +64,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const History& h,
 
   captureThreshold = 0;
   curMove = lastMove = moves;
-  badCaptures = moves + MAX_MOVES;
+  lastBadCapture = moves + MAX_MOVES - 1;
 
   if (p.in_check())
       phase = EVASION;
@@ -242,10 +242,9 @@ void MovePicker::generate_next() {
       return;
 
   case BAD_CAPTURES_S1:
-      // Bad captures SEE value is already calculated so just pick them in order
-      // to get SEE move ordering.
-      curMove = badCaptures;
-      lastMove = moves + MAX_MOVES;
+      // Just pick them in reverse order to get MVV/LVA ordering
+      curMove = moves + MAX_MOVES - 1;
+      lastMove = lastBadCapture;
       return;
 
   case EVASIONS_S2:
@@ -297,13 +296,11 @@ Move MovePicker::next_move() {
           {
               assert(captureThreshold <= 0); // Otherwise we cannot use see_sign()
 
-              int seeScore = pos.see_sign(move);
-              if (seeScore >= captureThreshold)
+              if (pos.see_sign(move) >= captureThreshold)
                   return move;
 
               // Losing capture, move it to the tail of the array
-              (--badCaptures)->move = move;
-              badCaptures->score = seeScore;
+              (lastBadCapture--)->move = move;
           }
           break;
 
@@ -325,8 +322,7 @@ Move MovePicker::next_move() {
           break;
 
       case BAD_CAPTURES_S1:
-          move = pick_best(curMove++, lastMove)->move;
-          return move;
+          return (curMove--)->move;
 
       case EVASIONS_S2: case CAPTURES_S3: case CAPTURES_S4:
           move = pick_best(curMove++, lastMove)->move;
index 5084f1e06e06d6edab80ca13d8391b26849f6885..03305ebdd8eab7cf02ce27fbdb56af2c22ada3e2 100644 (file)
@@ -56,7 +56,7 @@ private:
   MoveStack killers[2];
   Square recaptureSquare;
   int captureThreshold, phase;
-  MoveStack *curMove, *lastMove, *lastQuiet, *badCaptures;
+  MoveStack *curMove, *lastMove, *lastQuiet, *lastBadCapture;
   MoveStack moves[MAX_MOVES];
 };