X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fpawns.cpp;h=16b00ec2fa012cbf36e75001e3811e661bc91f1a;hp=2fc8e73666fb78e94d46b75f0dca635f80e6b280;hb=94dd204c3b10ebe0e6c8df5d7c98de5ba4906cad;hpb=480682b67097160bfc25e52ab02facffeec104f0 diff --git a/src/pawns.cpp b/src/pawns.cpp index 2fc8e736..16b00ec2 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -57,9 +57,6 @@ namespace { 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); - // Unsupported pawn penalty const Score UnsupportedPawnPenalty = S(20, 10); @@ -168,7 +165,7 @@ namespace { value -= UnsupportedPawnPenalty; if (doubled) - value -= Doubled[f] / rank_distance(s, lsb(doubled)); + value -= Doubled[f] / distance(s, frontmost_sq(Us, doubled)); if (backward) value -= Backward[opposed][f]; @@ -183,10 +180,6 @@ namespace { b = e->semiopenFiles[Us] ^ 0xFF; e->pawnSpan[Us] = b ? int(msb(b) - lsb(b)) : 0; - // 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. - value += PawnsFileSpan * e->pawnSpan[Us]; - return value; } @@ -275,14 +268,14 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) { kingSquares[Us] = ksq; castlingRights[Us] = pos.can_castle(Us); - minKPdistance[Us] = 0; + minKingPawnDistance[Us] = 0; Bitboard pawns = pos.pieces(Us, PAWN); if (pawns) - while (!(DistanceRingsBB[ksq][minKPdistance[Us]++] & pawns)) {} + while (!(DistanceRingsBB[ksq][minKingPawnDistance[Us]++] & pawns)) {} if (relative_rank(Us, ksq) > RANK_4) - return make_score(0, -16 * minKPdistance[Us]); + return make_score(0, -16 * minKingPawnDistance[Us]); Value bonus = shelter_storm(pos, ksq); @@ -293,7 +286,7 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) { if (pos.can_castle(MakeCastling::right)) bonus = std::max(bonus, shelter_storm(pos, relative_square(Us, SQ_C1))); - return make_score(bonus, -16 * minKPdistance[Us]); + return make_score(bonus, -16 * minKingPawnDistance[Us]); } // Explicit template instantiation