]> git.sesse.net Git - stockfish/commitdiff
Shortcut sorting when no move is in history
authorMarco Costalba <mcostalba@gmail.com>
Wed, 15 Oct 2008 18:39:09 +0000 (20:39 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 18 Oct 2008 19:35:20 +0000 (21:35 +0200)
An alternative algorithm to psqt scoring.

Still unclear what is the best, more tests needed.

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

index d0ceaf1c23e8166263e88d10401c035e9cc0d2e5..1a00367b334314ab80fee3d7abf46913058fcdfd 100644 (file)
@@ -247,35 +247,35 @@ void MovePicker::score_captures() {
 
 void MovePicker::score_noncaptures() {
 
-  bool all_zero = true;
+  All_zero = true;
   for (int i = 0; i < numOfMoves; i++)
   {
       Move m = moves[i].move;
       if (m == killer1)
       {
           moves[i].score = HistoryMax + 2;
-          all_zero = false;
+          All_zero = false;
       }
       else if (m == killer2)
       {
           moves[i].score = HistoryMax + 1;
-          all_zero = false;
+          All_zero = false;
       }
       else
       {
           moves[i].score = H.move_ordering_score(pos->piece_on(move_from(m)), m);
-          if (all_zero && moves[i].score != 0)
-              all_zero = false;
+          if (All_zero && moves[i].score != 0)
+              All_zero = false;
       }
   }
-  if (!all_zero)
-      return;
+  //if (!all_zero)
+  //    return;
 
   // If we don't have at least one history score then
   // try to order using psq tables difference between 
   // from square and to square.
-  for (int i = 0; i < numOfMoves; i++)
-      moves[i].score = pos->mg_pst_delta(moves[i].move);
+  //for (int i = 0; i < numOfMoves; i++)
+  //    moves[i].score = pos->mg_pst_delta(moves[i].move);
 }
 
 void MovePicker::score_evasions() {
@@ -359,7 +359,7 @@ Move MovePicker::pick_move_from_list() {
       // the entire move list for the best move.  If many moves have already
       // been searched and it is not a PV node, we are probably failing low
       // anyway, so we just pick the first move from the list.
-      if(pvNode || movesPicked < 12) {
+      if(!All_zero && (pvNode || movesPicked < 12)) {
         bestIndex = -1;
         for(int i = movesPicked; i < numOfMoves; i++)
           if(moves[i].score > bestScore) {
index df2012fe6fa0b67bbe2ade133744d39ab4b8b6e7..b60dfe06ac0c224717c652458e2911a59dacdfd0 100644 (file)
@@ -87,6 +87,7 @@ private:
   int numOfMoves, numOfBadCaptures;
   int movesPicked, badCapturesPicked;
   bool finished;
+  bool All_zero;
 };