X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=1653e23ad5181b01bb9a1f16c16e794faddc1a0f;hp=47f74f84ee77888d60dacf0e03251977d3cc82ff;hb=52eac1e53512f4388bb310cb4d653ce18c9c4c63;hpb=e6310b3469b07b6bbecf8d8f75367a655090f22b diff --git a/src/pawns.cpp b/src/pawns.cpp index 47f74f84..1653e23a 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -57,12 +57,6 @@ 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] @@ -106,6 +100,10 @@ namespace { const Square Right = (Us == WHITE ? DELTA_NE : DELTA_SW); const Square Left = (Us == WHITE ? DELTA_NW : DELTA_SE); + const Bitboard CenterBindMask = + Us == WHITE ? (FileDBB | FileEBB) & (Rank5BB | Rank6BB | Rank7BB) + : (FileDBB | FileEBB) & (Rank4BB | Rank3BB | Rank2BB); + Bitboard b, neighbours, doubled, supported, phalanx; Square s; bool passed, isolated, opposed, backward, lever, connected; @@ -116,7 +114,7 @@ namespace { Bitboard ourPawns = pos.pieces(Us , PAWN); Bitboard theirPawns = pos.pieces(Them, PAWN); - e->passedPawns[Us] = 0; + e->passedPawns[Us] = e->pawnAttacksSpan[Us] = 0; e->kingSquares[Us] = SQ_NONE; e->semiopenFiles[Us] = 0xFF; e->pawnAttacks[Us] = shift_bb(ourPawns) | shift_bb(ourPawns); @@ -130,8 +128,8 @@ namespace { File f = file_of(s); - // This file cannot be semi-open e->semiopenFiles[Us] &= ~(1 << f); + e->pawnAttacksSpan[Us] |= pawn_attack_span(Us, s); // Flag the pawn neighbours = ourPawns & adjacent_files_bb(f); @@ -198,7 +196,7 @@ namespace { 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]; + b = shift_bb(ourPawns) & shift_bb(ourPawns) & CenterBindMask; score += popcount(b) * CenterBind; return score; @@ -243,6 +241,7 @@ Entry* probe(const Position& pos) { e->key = key; e->score = evaluate(pos, e) - evaluate(pos, e); + e->asymmetry = popcount(e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK]); return e; }