]> git.sesse.net Git - stockfish/commitdiff
Use gain table to order non-captures
authorMarco Costalba <mcostalba@gmail.com>
Thu, 4 Feb 2010 18:24:41 +0000 (19:24 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 7 Feb 2010 07:55:51 +0000 (08:55 +0100)
Gain value is multiplied by 16 to be of comparable magnitudo
of negative history, on average.

This patch shows very good results in tactical tests, but
started very bad in real games, so I have run two test matches.

After 896 games at 1+0
Mod vs Orig +187 =525 -184 +1 ELO

After 999 games at 1+0
Mod vs Orig +223 =590 -186 +13 ELO

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

index 582978e69d0c3f1fb2c6535c82d71f564cc85aa7..6bb5c315554abab89fe17896af79e7427af2e980 100644 (file)
@@ -213,6 +213,7 @@ void MovePicker::score_noncaptures() {
   Move m;
   Piece piece;
   Square from, to;
   Move m;
   Piece piece;
   Square from, to;
+  int hs;
 
   for (MoveStack* cur = moves; cur != lastMove; cur++)
   {
 
   for (MoveStack* cur = moves; cur != lastMove; cur++)
   {
@@ -220,7 +221,14 @@ void MovePicker::score_noncaptures() {
       from = move_from(m);
       to = move_to(m);
       piece = pos.piece_on(from);
       from = move_from(m);
       to = move_to(m);
       piece = pos.piece_on(from);
-      cur->score = H.move_ordering_score(piece, to);
+      hs = H.move_ordering_score(piece, to);
+
+      // Ensure history has always highest priority
+      if (hs > 0)
+          hs += 10000;
+
+      // Gain table based scoring
+      cur->score = hs + 16 * H.gain(piece, to);
   }
 }
 
   }
 }