]> git.sesse.net Git - stockfish/commitdiff
Penalty for Knight when enemy pawns are few
authorJörg Oster <osterj165@googlemail.com>
Sun, 20 Oct 2013 18:59:48 +0000 (20:59 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 24 Oct 2013 18:11:33 +0000 (20:11 +0200)
This seems more a material imbalance topic,
anyhow test is good and so patch is applied
as is.

Passed both short TC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 17391 W: 3548 L: 3393 D: 10450

And long TC:
LLR: 3.00 (-2.94,2.94) [0.00,6.00]
Total: 34660 W: 5972 L: 5700 D: 22988

bench: 8291883

src/evaluate.cpp

index 787004b4e7ac59b65f20b8764dae93358aaa5274..1ff2dea7744c520daff7073c2bc315f0778648af 100644 (file)
@@ -172,6 +172,7 @@ namespace {
   const Score RookOpenFile     = make_score(43, 21);
   const Score RookSemiopenFile = make_score(19, 10);
   const Score BishopPawns      = make_score( 8, 12);
   const Score RookOpenFile     = make_score(43, 21);
   const Score RookSemiopenFile = make_score(19, 10);
   const Score BishopPawns      = make_score( 8, 12);
+  const Score KnightPawns      = make_score( 8,  4);
   const Score MinorBehindPawn  = make_score(16,  0);
   const Score UndefendedMinor  = make_score(25, 10);
   const Score TrappedRook      = make_score(90,  0);
   const Score MinorBehindPawn  = make_score(16,  0);
   const Score UndefendedMinor  = make_score(25, 10);
   const Score TrappedRook      = make_score(90,  0);
@@ -529,6 +530,10 @@ Value do_evaluate(const Position& pos, Value& margin) {
         if (Piece == BISHOP)
             score -= BishopPawns * ei.pi->pawns_on_same_color_squares(Us, s);
 
         if (Piece == BISHOP)
             score -= BishopPawns * ei.pi->pawns_on_same_color_squares(Us, s);
 
+        // Penalty for knight when there are few enemy pawns
+        if (Piece == KNIGHT)
+            score -= KnightPawns * std::max(5 - pos.count<PAWN>(Them), 0);
+
         if (Piece == BISHOP || Piece == KNIGHT)
         {
             // Bishop and knight outposts squares
         if (Piece == BISHOP || Piece == KNIGHT)
         {
             // Bishop and knight outposts squares