X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=259a5bc5b6086ae927c8bc77669e44b303f0dfd4;hp=177d29345fa38613143630e7a01564f4ce58039b;hb=01ee509a5c33e11d7d62d2f325f55720d8be9cfb;hpb=b4f6728e610848b202cee47af28fa3bb0a251e3c diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 177d2934..259a5bc5 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -210,7 +210,7 @@ namespace { // in KingDanger[]. Various little "meta-bonuses" measuring the strength // of the enemy attack are added up into an integer, which is used as an // index to KingDanger[]. - Score KingDanger[512]; + Score KingDanger[400]; // KingAttackWeights[PieceType] contains king attack weights by piece type const int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 7, 5, 4, 1 }; @@ -360,7 +360,8 @@ namespace { if (Pt == QUEEN) { // Penalty if any relative pin or discovered attack against the queen - if (pos.slider_blockers(pos.pieces(Them, ROOK, BISHOP), s)) + Bitboard pinners; + if (pos.slider_blockers(pos.pieces(Them, ROOK, BISHOP), s, pinners)) score -= WeakQueen; } } @@ -706,9 +707,9 @@ namespace { // ...count safe + (behind & safe) with a single popcount int bonus = popcount((Us == WHITE ? safe << 32 : safe >> 32) | (behind & safe)); bonus = std::min(16, bonus); - int weight = pos.count(Us); + int weight = pos.count(Us) - 2 * ei.pi->open_files(); - return make_score(bonus * weight * weight / 22, 0); + return make_score(bonus * weight * weight / 18, 0); } @@ -779,23 +780,22 @@ Value Eval::evaluate(const Position& pos) { assert(!pos.checkers()); + Score mobility[COLOR_NB] = { SCORE_ZERO, SCORE_ZERO }; EvalInfo ei; - Score score, mobility[COLOR_NB] = { SCORE_ZERO, SCORE_ZERO }; - - // Initialize score by reading the incrementally updated scores included in - // the position object (material + piece square tables). Score is computed - // internally from the white point of view. - score = pos.psq_score(); // Probe the material hash table ei.me = Material::probe(pos); - score += ei.me->imbalance(); // If we have a specialized evaluation function for the current material // configuration, call it and return. if (ei.me->specialized_eval_exists()) return ei.me->evaluate(pos); + // Initialize score by reading the incrementally updated scores included in + // the position object (material + piece square tables) and the material + // imbalance. Score is computed internally from the white point of view. + Score score = pos.psq_score() + ei.me->imbalance(); + // Probe the pawn hash table ei.pi = Pawns::probe(pos); score += ei.pi->pawns_score();