X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=0bc2a632ae9b0304f0927c20621d912ce52e668e;hp=5d7aa4e3c203a45dc25a2e9a6a90433f526e0844;hb=2312c2672299d6e13b2f509bf5b1a6e330662f09;hpb=0e8ad40ef0303c5c3bc13ff0ddcaa488f91b73fc diff --git a/src/pawns.cpp b/src/pawns.cpp index 5d7aa4e3..0bc2a632 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -57,6 +57,11 @@ 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) }; + // Levers bonus by rank + const Score Lever[RANK_NB] = { + S( 0, 0), S( 0, 0), S(0, 0), S(0, 0), + S(20,20), S(40,40), S(0, 0), S(0, 0) }; + // Bonus for file distance of the two outermost pawns const Score PawnsFileSpan = S(0, 15); @@ -88,11 +93,12 @@ namespace { const Square Up = (Us == WHITE ? DELTA_N : DELTA_S); const Square Right = (Us == WHITE ? DELTA_NE : DELTA_SW); const Square Left = (Us == WHITE ? DELTA_NW : DELTA_SE); + const Piece pc = make_piece(Us, PAWN); Bitboard b, p, doubled; Square s; File f; - bool passed, isolated, opposed, connected, backward, candidate, unsupported; + bool passed, isolated, opposed, connected, backward, candidate, unsupported, lever; Score value = SCORE_ZERO; const Square* pl = pos.list(Us); @@ -130,6 +136,7 @@ namespace { doubled = ourPawns & forward_bb(Us, s); opposed = theirPawns & forward_bb(Us, s); passed = !(theirPawns & passed_pawn_mask(Us, s)); + lever = theirPawns & StepAttacksBB[pc][s]; // Test for backward pawn. // If the pawn is passed, isolated, or connected it cannot be @@ -192,6 +199,9 @@ namespace { if (!doubled) e->candidatePawns[Us] |= s; } + + if (lever) + value += Lever[relative_rank(Us, s)]; } // In endgame it's better to have pawns on both wings. So give a bonus according @@ -270,7 +280,7 @@ Value Entry::shelter_storm(const Position& pos, Square ksq) { if ( (MiddleEdges & make_square(f, rkThem)) && file_of(ksq) == f && relative_rank(Us, ksq) == rkThem - 1) - safety += Value(200); + safety += 200; else safety -= ShelterWeakness[rkUs] + StormDanger[rkUs == RANK_1 ? 0 : rkThem == rkUs + 1 ? 2 : 1][rkThem];