X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=5a28b286ae0a354c1f01eb6c445fb83fc85eaa13;hp=dedecfd16c73defa50fefb664189189cf8a898cd;hb=a9b8e8b9318130621acf21f5a2b3a705b63907d3;hpb=6c9f4cf36f54a2437c843ebe0184a3356da9d82a diff --git a/src/evaluate.cpp b/src/evaluate.cpp index dedecfd1..5a28b286 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -160,7 +160,7 @@ namespace { const Score RookSemiopenFile = make_score(19, 10); const Score BishopPawns = make_score( 8, 12); const Score MinorBehindPawn = make_score(16, 0); - const Score TrappedRook = make_score(90, 0); + const Score TrappedRook = make_score(92, 0); const Score Unstoppable = make_score( 0, 20); // Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by @@ -350,7 +350,7 @@ namespace { if ( ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq))) && (rank_of(ksq) == rank_of(s) || relative_rank(Us, ksq) == RANK_1) && !ei.pi->semiopen_side(Us, file_of(ksq), file_of(s) < file_of(ksq))) - score -= (TrappedRook - make_score(mob * 8, 0)) * (1 + !pos.can_castle(Us)); + score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us)); } // An important Chess960 pattern: A cornered bishop blocked by a friendly @@ -496,9 +496,17 @@ namespace { const Color Them = (Us == WHITE ? BLACK : WHITE); - Bitboard b, weakEnemies; + Bitboard b, weakEnemies, protectedEnemies; Score score = SCORE_ZERO; + // Protected enemies + protectedEnemies = (pos.pieces(Them) ^ pos.pieces(Them,PAWN)) + & ei.attackedBy[Them][PAWN] + & (ei.attackedBy[Us][KNIGHT] | ei.attackedBy[Us][BISHOP]); + + if(protectedEnemies) + score += Threat[0][type_of(pos.piece_on(lsb(protectedEnemies)))]; + // Enemies not defended by a pawn and under our attack weakEnemies = pos.pieces(Them) & ~ei.attackedBy[Them][PAWN] @@ -597,6 +605,8 @@ namespace { mbonus += k * rr, ebonus += k * rr; } + else if(pos.pieces(Us) & blockSq) + mbonus += rr * 3 + r * 2 + 3, ebonus += rr + r * 2; } // rr != 0 if (pos.count(Us) < pos.count(Them)) @@ -750,8 +760,10 @@ namespace { // Endgame with opposite-colored bishops, but also other pieces. Still // a bit drawish, but not as drawish as with only the two bishops. sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL); - } else if ( ei.pi->pawn_span(strongSide) <= 1 && - !pos.pawn_passed(~strongSide, pos.king_square(~strongSide))) { + } else if ( abs(eg_value(score)) <= BishopValueEg + && ei.pi->pawn_span(strongSide) <= 1 + && !pos.pawn_passed(~strongSide, pos.king_square(~strongSide))) { + // Endings where weaker side can be place his king in front of the opponent's pawns are drawish. sf = ScaleFactor(ScalePawnSpan[ei.pi->pawn_span(strongSide)]); } }