X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=fa3b0a720b2face4a2ac66d6085370f3b8e77e43;hp=47a65c592cdfb7ef3456f27e99cca109ebb5ae0d;hb=66ce8ad5fd0e67904ca96dd9ac58f2e512a1f380;hpb=be6fafd0793d934c31925832b4bde569b5abd5b9 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 47a65c59..fa3b0a72 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -2,7 +2,7 @@ Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad - Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad + Copyright (C) 2015-2018 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -220,7 +220,6 @@ namespace { const Score WeakQueen = S( 50, 10); const Score CloseEnemies = S( 7, 0); const Score PawnlessFlank = S( 20, 80); - const Score ThreatByHangingPawn = S( 71, 61); const Score ThreatBySafePawn = S(192,175); const Score ThreatByRank = S( 16, 3); const Score Hanging = S( 48, 27); @@ -310,8 +309,8 @@ namespace { while ((s = *pl++) != SQ_NONE) { // Find attacked squares, including x-ray attacks for bishops and rooks - b = Pt == BISHOP ? attacks_bb(s, pos.pieces() ^ pos.pieces(Us, QUEEN)) - : Pt == ROOK ? attacks_bb< ROOK>(s, pos.pieces() ^ pos.pieces(Us, ROOK, QUEEN)) + b = Pt == BISHOP ? attacks_bb(s, pos.pieces() ^ pos.pieces(QUEEN)) + : Pt == ROOK ? attacks_bb< ROOK>(s, pos.pieces() ^ pos.pieces(QUEEN) ^ pos.pieces(Us, ROOK)) : pos.attacks_from(s); if (pos.pinned_pieces(Us) & s) @@ -543,9 +542,6 @@ namespace { safeThreats = (shift(b) | shift(b)) & weak; score += ThreatBySafePawn * popcount(safeThreats); - - if (weak ^ safeThreats) - score += ThreatByHangingPawn; } // Squares strongly protected by the opponent, either because they attack the @@ -891,7 +887,7 @@ namespace { Trace::add(TOTAL, score); } - return (pos.side_to_move() == WHITE ? v : -v) + Eval::Tempo; // Side to move point of view + return pos.side_to_move() == WHITE ? v : -v; // Side to move point of view } } // namespace @@ -903,7 +899,7 @@ Score Eval::Contempt = SCORE_ZERO; Value Eval::evaluate(const Position& pos) { - return Evaluation<>(pos).value(); + return Evaluation<>(pos).value() + Eval::Tempo; } /// trace() is like evaluate(), but instead of returning a value, it returns @@ -914,7 +910,7 @@ std::string Eval::trace(const Position& pos) { std::memset(scores, 0, sizeof(scores)); - Value v = Evaluation(pos).value(); + Value v = Evaluation(pos).value() + Eval::Tempo; v = pos.side_to_move() == WHITE ? v : -v; // White's point of view std::stringstream ss;