X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=a63b40ae98403a69153a2782c1bd066c75f2d153;hb=db4b0d8b7db8db15c16a71212990354094f00b0d;hp=d040143272c43ea6ee31d8f205306574b9f24cd8;hpb=647402ff7910ff26f5d6b967812d85f5f4259fee;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d0401432..a63b40ae 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -169,7 +169,7 @@ namespace { // We don't use a Score because we process the two components independently. const Value Passed[][RANK_NB] = { { V(5), V( 5), V(31), V(73), V(166), V(252) }, - { V(7), V(14), V(38), V(64), V(137), V(193) } + { V(7), V(14), V(38), V(73), V(166), V(252) } }; // PassedFile[File] contains a bonus according to the file of a passed pawn @@ -185,6 +185,7 @@ namespace { const Score TrappedRook = S(92, 0); const Score Checked = S(20, 20); const Score ThreatByHangingPawn = S(70, 63); + const Score LooseEnemies = S( 0, 25); const Score Hanging = S(48, 28); const Score ThreatByPawnPush = S(31, 19); const Score Unstoppable = S( 0, 20); @@ -424,36 +425,20 @@ namespace { b2 = pos.attacks_from(ksq) & safe; // Enemy queen safe checks - b = (b1 | b2) & ei.attackedBy[Them][QUEEN]; - if (b) - { - attackUnits += QueenCheck * popcount(b); - score -= Checked; - } + if ((b1 | b2) & ei.attackedBy[Them][QUEEN]) + attackUnits += QueenCheck, score -= Checked; // Enemy rooks safe checks - b = b1 & ei.attackedBy[Them][ROOK]; - if (b) - { - attackUnits += RookCheck * popcount(b); - score -= Checked; - } + if (b1 & ei.attackedBy[Them][ROOK]) + attackUnits += RookCheck, score -= Checked; // Enemy bishops safe checks - b = b2 & ei.attackedBy[Them][BISHOP]; - if (b) - { - attackUnits += BishopCheck * popcount(b); - score -= Checked; - } + if (b2 & ei.attackedBy[Them][BISHOP]) + attackUnits += BishopCheck, score -= Checked; // Enemy knights safe checks - b = pos.attacks_from(ksq) & ei.attackedBy[Them][KNIGHT] & safe; - if (b) - { - attackUnits += KnightCheck * popcount(b); - score -= Checked; - } + if (pos.attacks_from(ksq) & ei.attackedBy[Them][KNIGHT] & safe) + attackUnits += KnightCheck, score -= Checked; // Finally, extract the king danger score from the KingDanger[] // array and subtract the score from the evaluation. @@ -485,6 +470,11 @@ namespace { Bitboard b, weak, defended, safeThreats; Score score = SCORE_ZERO; + // Small bonus if the opponent has loose pawns or pieces + if ( (pos.pieces(Them) ^ pos.pieces(Them, QUEEN, KING)) + & ~(ei.attackedBy[Us][ALL_PIECES] | ei.attackedBy[Them][ALL_PIECES])) + score += LooseEnemies; + // Non-pawn enemies attacked by a pawn weak = (pos.pieces(Them) ^ pos.pieces(Them, PAWN)) & ei.attackedBy[Us][PAWN];