]> git.sesse.net Git - stockfish/commitdiff
Add a penalty for low mobility pieces
authorGary Linscott <glinscott@gmail.com>
Thu, 10 Apr 2014 06:34:14 +0000 (08:34 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 10 Apr 2014 06:35:10 +0000 (08:35 +0200)
Passed both STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 81857 W: 14652 L: 14342 D: 52863

and LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 45400 W: 6999 L: 6697 D: 31704

bench: 7716978

src/evaluate.cpp

index e96e635c876f44901a456b41189c98eddbcb85e9..9c5c12b8b7003c62d31d66064f2840bf1355cece 100644 (file)
@@ -171,6 +171,7 @@ namespace {
   const Score UndefendedMinor  = make_score(25, 10);
   const Score TrappedRook      = make_score(90,  0);
   const Score Unstoppable      = make_score( 0, 20);
   const Score UndefendedMinor  = make_score(25, 10);
   const Score TrappedRook      = make_score(90,  0);
   const Score Unstoppable      = make_score( 0, 20);
+  const Score LowMobPenalty    = make_score(40, 20);
 
   // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
   // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
 
   // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
   // a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
@@ -186,6 +187,8 @@ namespace {
     (FileCBB | FileDBB | FileEBB | FileFBB) & (Rank7BB | Rank6BB | Rank5BB)
   };
 
     (FileCBB | FileDBB | FileEBB | FileFBB) & (Rank7BB | Rank6BB | Rank5BB)
   };
 
+  const Bitboard EdgeBB = Rank1BB | Rank8BB | FileABB | FileHBB;
+
   // King danger constants and variables. The king danger scores are taken
   // from KingDanger[]. Various little "meta-bonuses" measuring the strength
   // of the enemy attack are added up into an integer, which is used as an
   // King danger constants and variables. The king danger scores are taken
   // from KingDanger[]. Various little "meta-bonuses" measuring the strength
   // of the enemy attack are added up into an integer, which is used as an
@@ -491,6 +494,9 @@ Value do_evaluate(const Position& pos) {
 
         mobility[Us] += MobilityBonus[Pt][mob];
 
 
         mobility[Us] += MobilityBonus[Pt][mob];
 
+        if (mob <= 1 && (EdgeBB & s))
+            score -= LowMobPenalty;
+
         // Decrease score if we are attacked by an enemy pawn. The remaining part
         // of threat evaluation must be done later when we have full attack info.
         if (ei.attackedBy[Them][PAWN] & s)
         // Decrease score if we are attacked by an enemy pawn. The remaining part
         // of threat evaluation must be done later when we have full attack info.
         if (ei.attackedBy[Them][PAWN] & s)