X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=11ac43d5ee935ab06be0cc77130cfc48cd1763e0;hb=ab4f498bbcf6f263bf3a355c3fff4ccaa8dea1d8;hp=4ce500af8ea634171a406284b40a9832192acbf2;hpb=8f30d233f891efc561ba3446ef8b9560c8369645;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 4ce500af..11ac43d5 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -190,14 +190,12 @@ namespace { const Score RookOnPawn = S( 8, 24); const Score TrappedRook = S(92, 0); const Score CloseEnemies = S( 7, 0); - const Score SafeCheck = S(20, 20); const Score OtherCheck = S(10, 10); const Score ThreatByHangingPawn = S(71, 61); const Score LooseEnemies = S( 0, 25); - const Score WeakQueen = S(35, 0); + const Score WeakQueen = S(50, 10); const Score Hanging = S(48, 27); const Score ThreatByPawnPush = S(38, 22); - const Score Unstoppable = S( 0, 20); const Score PawnlessFlank = S(20, 80); const Score HinderPassedPawn = S( 7, 0); const Score ThreatByRank = S(16, 3); @@ -215,10 +213,10 @@ namespace { // Penalties for enemy's safe checks const int QueenContactCheck = 997; - const int QueenCheck = 695; - const int RookCheck = 638; - const int BishopCheck = 538; - const int KnightCheck = 874; + const int QueenCheck = 745; + const int RookCheck = 688; + const int BishopCheck = 588; + const int KnightCheck = 924; // eval_init() initializes king and attack bitboards for a given color @@ -349,7 +347,6 @@ namespace { Square ksq = pos.square(Us); 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 * 22, 0)) * (1 + !pos.can_castle(Us)); } @@ -449,7 +446,7 @@ namespace { // Enemy queen safe checks if ((b1 | b2) & ei.attackedBy[Them][QUEEN] & safe) - kingDanger += QueenCheck, score -= SafeCheck; + kingDanger += QueenCheck; // For other pieces, also consider the square safe if attacked twice, // and only defended by a queen. @@ -459,14 +456,14 @@ namespace { // Enemy rooks safe and other checks if (b1 & ei.attackedBy[Them][ROOK] & safe) - kingDanger += RookCheck, score -= SafeCheck; + kingDanger += RookCheck; else if (b1 & ei.attackedBy[Them][ROOK] & other) score -= OtherCheck; // Enemy bishops safe and other checks if (b2 & ei.attackedBy[Them][BISHOP] & safe) - kingDanger += BishopCheck, score -= SafeCheck; + kingDanger += BishopCheck; else if (b2 & ei.attackedBy[Them][BISHOP] & other) score -= OtherCheck; @@ -474,7 +471,7 @@ namespace { // Enemy knights safe and other checks b = pos.attacks_from(ksq) & ei.attackedBy[Them][KNIGHT]; if (b & safe) - kingDanger += KnightCheck, score -= SafeCheck; + kingDanger += KnightCheck; else if (b & other) score -= OtherCheck; @@ -679,6 +676,10 @@ namespace { mbonus += rr + r * 2, ebonus += rr + r * 2; } // rr != 0 + // Assign a small bonus when no pieces left (unstoppable) + if (!pos.non_pawn_material(Us) && !pos.non_pawn_material(Them)) + ebonus += 20; + score += make_score(mbonus, ebonus) + PassedFile[file_of(s)]; } @@ -853,17 +854,6 @@ Value Eval::evaluate(const Position& pos) { score += evaluate_passed_pawns(pos, ei) - evaluate_passed_pawns(pos, ei); - // If both sides have only pawns, score for potential unstoppable pawns - if (!pos.non_pawn_material(WHITE) && !pos.non_pawn_material(BLACK)) - { - Bitboard b; - if ((b = ei.pi->passed_pawns(WHITE)) != 0) - score += Unstoppable * int(relative_rank(WHITE, frontmost_sq(WHITE, b))); - - if ((b = ei.pi->passed_pawns(BLACK)) != 0) - score -= Unstoppable * int(relative_rank(BLACK, frontmost_sq(BLACK, b))); - } - // Evaluate space for both sides, only during opening if (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) >= 12222) score += evaluate_space(pos, ei)