X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpawns.cpp;h=5c7a55be74cccabb5951bf0d764db20f77060f67;hb=14aebe2b7ce1fa3ba7570168115ac3b0077ea97a;hp=37db673f2ff2ede1b03e62808ce3db223d7f29c5;hpb=431c3ac485386cc10413fc8a3c7d338dcc71602d;p=stockfish diff --git a/src/pawns.cpp b/src/pawns.cpp index 37db673f..5c7a55be 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -57,6 +57,9 @@ namespace { S( 0, 0), S( 6, 13), S(6,13), S(14,29), S(34,68), S(83,166), S(0, 0), S( 0, 0) }; + // Bonus for file distance of the two outermost pawns + const Score PawnsFileSpan = S(0, 10); + // Weakness of our pawn shelter in front of the king indexed by [rank] const Value ShelterWeakness[RANK_NB] = { V(100), V(0), V(27), V(73), V(92), V(101), V(101) }; @@ -181,6 +184,14 @@ namespace { } } + // In endgame it's better to have pawns on both wings. So give a bonus according + // to file distance between left and right outermost pawns. + if (pos.count(Us) > 1) + { + b = e->semiopenFiles[Us] ^ 0xFF; + value += PawnsFileSpan * int(msb(b) - lsb(b)); + } + return value; }