X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=02810b78490093f1f14f7c220897f2661f4bc63f;hp=8192536f38990d04217c1b6a918b9bf27d516189;hb=ea4e22be1da1ccbf316d27f2eb3b14d0e13388e4;hpb=76caef8ba1fb4ca0520a8e2b42815d626484e93c diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 8192536f..02810b78 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -150,6 +150,8 @@ namespace { #undef S + const Score BishopPinBonus = make_score(66, 11); + // Bonus for having the side to move (modified by Joona Kiiski) const Score Tempo = make_score(24, 11); @@ -577,22 +579,15 @@ Value do_evaluate(const Position& pos, Value& margin) { mobility += MobilityBonus[Piece][mob]; - // Add a bonus if a slider is pinning an enemy piece - if ( (Piece == BISHOP || Piece == ROOK || Piece == QUEEN) - && (PseudoAttacks[Piece][pos.king_square(Them)] & s)) - { - b = BetweenBB[s][pos.king_square(Them)] & pos.pieces(); - - assert(b); - - if (!more_than_one(b) && (b & pos.pieces(Them))) - score += ThreatBonus[Piece][type_of(pos.piece_on(lsb(b)))]; - } - // Decrease score if we are attacked by an enemy pawn. Remaining part // of threat evaluation must be done later when we have full attack info. if (ei.attackedBy[Them][PAWN] & s) score -= ThreatenedByPawnPenalty[Piece]; + else if (Piece == BISHOP && (PseudoAttacks[Piece][pos.king_square(Them)] & s)) { + const Bitboard between = BetweenBB[s][pos.king_square(Them)] & pos.pieces(); + if (!more_than_one(between)) + score += BishopPinBonus; + } // Bishop and knight outposts squares if ( (Piece == BISHOP || Piece == KNIGHT) @@ -699,8 +694,7 @@ Value do_evaluate(const Position& pos, Value& margin) { & ~ei.attackedBy[Them][0]; if (undefendedMinors) - score += more_than_one(undefendedMinors) ? UndefendedMinorPenalty * 2 - : UndefendedMinorPenalty; + score += UndefendedMinorPenalty; // Enemy pieces not defended by a pawn and under our attack weakEnemies = pos.pieces(Them)