]> git.sesse.net Git - stockfish/commitdiff
Scale eval when down to only one pawn
authorshane31 <shane_booth@acslink.net.au>
Tue, 31 Dec 2013 20:45:20 +0000 (07:45 +1100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 2 Jan 2014 11:44:46 +0000 (12:44 +0100)
Passed both short TC
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 11921 W: 2346 L: 2208 D: 7367

And long TC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 21002 W: 3395 L: 3197 D: 14410

bench: 7602383

src/evaluate.cpp
src/material.cpp
src/types.h

index 51d9b4290e6d48b3b324de5e6c459d5fd9d824a2..b43ab7e5be1a387f34c296f5a1afb39e17d38cf3 100644 (file)
@@ -358,9 +358,9 @@ Value do_evaluate(const Position& pos) {
 
   // If we don't already have an unusual scale factor, check for opposite
   // colored bishop endgames, and use a lower scale for those.
-  if (   ei.mi->game_phase() < PHASE_MIDGAME
-      && pos.opposite_bishops()
-      && sf == SCALE_FACTOR_NORMAL)
+  if (    ei.mi->game_phase() < PHASE_MIDGAME
+      &&  pos.opposite_bishops()
+      && (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN))
   {
       // Ignoring any pawns, do both sides only have a single bishop and no
       // other pieces?
@@ -375,7 +375,7 @@ Value do_evaluate(const Position& pos) {
       else
           // Endgame with opposite-colored bishops, but also other pieces. Still
           // a bit drawish, but not as drawish as with only the two bishops.
-           sf = ScaleFactor(50);
+           sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL);
   }
 
   Value v = interpolate(score, ei.mi->game_phase(), sf);
index 62ff1a747990b6ee043864224a20f26f78636226..a1eff233302982c1a6728da40c603075864dc5a2 100644 (file)
@@ -246,6 +246,16 @@ Entry* probe(const Position& pos, Table& entries, Endgames& endgames) {
       (npm_w == npm_b || npm_b < RookValueMg ? 0 : NoPawnsSF[std::min(pos.count<BISHOP>(BLACK), 2)]);
   }
 
+  if (pos.count<PAWN>(WHITE) == 1 && npm_w - npm_b <= BishopValueMg)
+  {
+      e->factor[WHITE] = (uint8_t) SCALE_FACTOR_ONEPAWN;
+  }
+
+  if (pos.count<PAWN>(BLACK) == 1 && npm_b - npm_w <= BishopValueMg)
+  {
+      e->factor[BLACK] = (uint8_t) SCALE_FACTOR_ONEPAWN;
+  }
+
   // Compute the space weight
   if (npm_w + npm_b >= 2 * QueenValueMg + 4 * RookValueMg + 2 * KnightValueMg)
   {
index b9fc71199e88cb96976c5640f5d63dd94aec8b96..6d558de9b7e9bd657992fa8ed5ec8977ec79bc55 100644 (file)
@@ -138,10 +138,11 @@ enum Phase {
 };
 
 enum ScaleFactor {
-  SCALE_FACTOR_DRAW   = 0,
-  SCALE_FACTOR_NORMAL = 64,
-  SCALE_FACTOR_MAX    = 128,
-  SCALE_FACTOR_NONE   = 255
+  SCALE_FACTOR_DRAW    = 0,
+  SCALE_FACTOR_ONEPAWN = 48,
+  SCALE_FACTOR_NORMAL  = 64,
+  SCALE_FACTOR_MAX     = 128,
+  SCALE_FACTOR_NONE    = 255
 };
 
 enum Bound {