X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fpawns.cpp;h=c5f1b22c270e2bd40bb7fb2537720a12fa5dcad4;hb=856a5f3aaaf8b9d53599963decacd4476b55c034;hp=1ae1b17fb1554d110b345c92633c7d6f87edf3b4;hpb=2dbb1adf2ac3c1655fd6b696c2e73c92e56e78d4;p=stockfish diff --git a/src/pawns.cpp b/src/pawns.cpp index 1ae1b17f..c5f1b22c 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -110,9 +110,9 @@ namespace { const Square Right = (Us == WHITE ? DELTA_NE : DELTA_SW); const Square Left = (Us == WHITE ? DELTA_NW : DELTA_SE); - Bitboard b, p, doubled, connected, supported; + Bitboard b, neighbours, doubled, connected, supported, phalanx; Square s; - bool passed, isolated, opposed, phalanx, backward, lever; + bool passed, isolated, opposed, backward, lever; Score score = SCORE_ZERO; const Square* pl = pos.list(Us); const Bitboard* pawnAttacksBB = StepAttacksBB[make_piece(Us, PAWN)]; @@ -137,21 +137,19 @@ namespace { // This file cannot be semi-open e->semiopenFiles[Us] &= ~(1 << f); - // Previous rank - p = rank_bb(s - Up); - // Flag the pawn - connected = ourPawns & adjacent_files_bb(f) & (rank_bb(s) | p); - phalanx = connected & rank_bb(s); - supported = connected & p; - isolated = !(ourPawns & adjacent_files_bb(f)); + neighbours = ourPawns & adjacent_files_bb(f); doubled = ourPawns & forward_bb(Us, s); opposed = theirPawns & forward_bb(Us, s); passed = !(theirPawns & passed_pawn_mask(Us, s)); lever = theirPawns & pawnAttacksBB[s]; + phalanx = neighbours & rank_bb(s); + supported = neighbours & rank_bb(s - Up); + connected = supported | phalanx; + isolated = !neighbours; // Test for backward pawn. - // If the pawn is passed, isolated, lever or connected it cannot be + // If the pawn is passed, isolated, connected or a lever it cannot be // backward. If there are friendly pawns behind on adjacent files // it cannot be backward either. if ( (passed | isolated | lever | connected) @@ -193,7 +191,7 @@ namespace { score -= Backward[opposed][f]; if (connected) - score += Connected[opposed][phalanx][more_than_one(supported)][relative_rank(Us, s)]; + score += Connected[opposed][!!phalanx][more_than_one(supported)][relative_rank(Us, s)]; if (lever) score += Lever[relative_rank(Us, s)];