X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=6377faf20d0881b0c13b8b63de39b41da65a6169;hb=759d129e4760938ded462a05061b421e18990937;hp=e39bcb4a8e99721820fa637151ace370d009f5d9;hpb=06a8fd2154db41c4e438a1b065c1471d0dfd5815;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index e39bcb4a..6377faf2 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -171,6 +171,7 @@ namespace { constexpr Score KnightOnQueen = S( 21, 11); constexpr Score LongDiagonalBishop = S( 22, 0); constexpr Score MinorBehindPawn = S( 16, 0); + constexpr Score Overload = S( 10, 5); constexpr Score PawnlessFlank = S( 20, 80); constexpr Score RookOnPawn = S( 8, 24); constexpr Score SliderOnQueen = S( 42, 21); @@ -300,6 +301,7 @@ namespace { Bitboard b, bb; Square s; Score score = SCORE_ZERO; + int mob; attackedBy[Us][Pt] = 0; @@ -324,7 +326,8 @@ namespace { kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]); } - int mob = popcount(b & mobilityArea[Us]); + mob = (Pt == KNIGHT || Pt == BISHOP) ? popcount(b & mobilityArea[Us] & ~pos.pieces(Us, QUEEN)) + : popcount(b & mobilityArea[Us]); mobility[Us] += MobilityBonus[Pt - 2][mob]; @@ -518,7 +521,7 @@ namespace { Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safeThreats; Score score = SCORE_ZERO; - // Non-pawn enemies attacked by a pawn + // Non-pawn enemies nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN); // Our safe or protected pawns @@ -606,6 +609,12 @@ namespace { b = (pos.pieces(Us) ^ pos.pieces(Us, PAWN, KING)) & attackedBy[Us][ALL_PIECES]; score += Connectivity * popcount(b); + // Bonus for overload (non-pawn enemies attacked and defended exactly once) + b = nonPawnEnemies + & attackedBy[Us][ALL_PIECES] & ~attackedBy2[Us] + & attackedBy[Them][ALL_PIECES] & ~attackedBy2[Them]; + score += Overload * popcount(b); + if (T) Trace::add(THREAT, Us, score);