X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=c0c7e5ff7098c52b0493ea94693142b9898263db;hp=60eee7a2a03e0f99af502a20ab60a3bf230faf63;hb=80ea80e4515e8ed7033ab2a8b22463865fb68979;hpb=917fe69f84ffcc53783e1ada41833684dc8a2970 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 60eee7a2..c0c7e5ff 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -396,10 +396,9 @@ namespace { // Penalty when trapped by the king, even more if the king cannot castle else if (mob <= 3) { - Square ksq = pos.square(Us); + File kf = file_of(pos.square(Us)); - if ( ((file_of(ksq) < FILE_E) == (file_of(s) < file_of(ksq))) - && !pe->semiopen_side(Us, file_of(ksq), file_of(s) < file_of(ksq))) + if ((kf < FILE_E) == (file_of(s) < kf)) score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us)); } } @@ -905,7 +904,7 @@ namespace { } // namespace -Score Eval::Contempt = SCORE_ZERO; +std::atomic Eval::Contempt; /// evaluate() is the evaluator for the outer world. It returns a static evaluation /// of the position from the point of view of the side to move. @@ -923,7 +922,10 @@ std::string Eval::trace(const Position& pos) { std::memset(scores, 0, sizeof(scores)); - Value v = Evaluation(pos).value() + Eval::Tempo; + Eval::Contempt = SCORE_ZERO; + + Value v = Eval::Tempo + Evaluation(pos).value(); + v = pos.side_to_move() == WHITE ? v : -v; // White's point of view std::stringstream ss;