X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=4642b34f4f63b681d5859229b86a67b0fc478eec;hp=49dc07fe671ef0885ca9b5fbfd29a8fd2cc885ad;hb=d0c2faa5fd9ad05f865d2a69b59efab43b2be421;hpb=bff65a211fcd626c170831878c90a3b440861e2a diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 49dc07fe..4642b34f 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -150,6 +150,8 @@ namespace { #undef S + Score BishopPinBonus = make_score(27, 12); + // Bonus for having the side to move (modified by Joona Kiiski) const Score Tempo = make_score(24, 11); @@ -306,6 +308,8 @@ namespace Eval { KingDangerTable[0][i] = apply_weight(make_score(t, 0), make_score(KingDanger[0], 0)); KingDangerTable[1][i] = apply_weight(make_score(t, 0), make_score(KingDanger[1], 0)); } + + BishopPinBonus = make_score(Options["pin_open"], Options["pin_end"]); } @@ -577,22 +581,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 +696,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)