X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=41c9e15d16247d6e27762add2b08f45658c24162;hp=ef456307cafbacb4479a53627a7a1d7b58aa362d;hb=2f465927363e3e753dfb65d67f9b126afc34f4fa;hpb=ddccb5355cabb7d1a9bf2c0fe3c51b3da0234260 diff --git a/src/pawns.cpp b/src/pawns.cpp index ef456307..41c9e15d 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -61,6 +61,14 @@ namespace { // Unsupported pawn penalty const Score UnsupportedPawnPenalty = S(20, 10); + // Center bind bonus: Two pawns controlling the same central square + const Bitboard CenterBindMask[COLOR_NB] = { + (FileDBB | FileEBB) & (Rank5BB | Rank6BB | Rank7BB), + (FileDBB | FileEBB) & (Rank4BB | Rank3BB | Rank2BB) + }; + + const Score CenterBind = S(16, 0); + // Weakness of our pawn shelter in front of the king by [distance from edge][rank] const Value ShelterWeakness[][RANK_NB] = { { V( 99), V(20), V(26), V(54), V(85), V( 92), V(108) }, @@ -195,6 +203,10 @@ namespace { b = e->semiopenFiles[Us] ^ 0xFF; e->pawnSpan[Us] = b ? int(msb(b) - lsb(b)) : 0; + // Center binds: Two pawns controlling the same central square + b = shift_bb(ourPawns) & shift_bb(ourPawns) & CenterBindMask[Us]; + score += popcount(b) * CenterBind; + return score; } @@ -215,7 +227,8 @@ void init() for (Rank r = RANK_2; r < RANK_8; ++r) { int bonus = Seed[r] + (phalanx ? (Seed[r + 1] - Seed[r]) / 2 : 0); - Connected[opposed][phalanx][r] = make_score(bonus / 2, bonus >> opposed); + bonus >>= opposed; + Connected[opposed][phalanx][r] = make_score( 3 * bonus / 2, bonus); } }