X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=b9f9ff505098acc04f7c221fb46779af34bcd5a1;hp=4987a53122d153e30ec6e87c727ba38e681a9426;hb=a010d438a2e378a82943835d49a53dfaa15c95d1;hpb=ee9e162dd5f18e18835164f94d9c5980806e518d diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 4987a531..b9f9ff50 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -148,10 +148,6 @@ namespace { #undef S - // Threats weights indexed by sente (side to move has a bigger weight) - const int ConcurrentThreatsWeight[2] = { 3, 15 }; - const int ThreatsWeight[2] = { 249, 267 }; - // Bonus for unstoppable passed pawns const Value UnstoppablePawnValue = Value(0x500); @@ -244,7 +240,7 @@ namespace { // Function prototypes template - Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID); + Value do_evaluate(const Position& pos, EvalInfo& ei); template void init_attack_tables(const Position& pos, EvalInfo& ei); @@ -281,21 +277,21 @@ namespace { /// evaluate() is the main evaluation function. It always computes two /// values, an endgame score and a middle game score, and interpolates /// between them based on the remaining material. -Value evaluate(const Position& pos, EvalInfo& ei, int threadID) { +Value evaluate(const Position& pos, EvalInfo& ei) { - return CpuHasPOPCNT ? do_evaluate(pos, ei, threadID) - : do_evaluate(pos, ei, threadID); + return CpuHasPOPCNT ? do_evaluate(pos, ei) + : do_evaluate(pos, ei); } namespace { template -Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID) { +Value do_evaluate(const Position& pos, EvalInfo& ei) { ScaleFactor factor[2]; assert(pos.is_ok()); - assert(threadID >= 0 && threadID < MAX_THREADS); + assert(pos.thread() >= 0 && pos.thread() < MAX_THREADS); assert(!pos.is_check()); memset(&ei, 0, sizeof(EvalInfo)); @@ -305,7 +301,7 @@ Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID) { ei.value = pos.value(); // Probe the material hash table - ei.mi = MaterialTable[threadID]->get_material_info(pos); + ei.mi = MaterialTable[pos.thread()]->get_material_info(pos); ei.value += ei.mi->material_value(); // If we have a specialized evaluation function for the current material @@ -318,7 +314,7 @@ Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID) { factor[BLACK] = ei.mi->scale_factor(pos, BLACK); // Probe the pawn hash table - ei.pi = PawnTable[threadID]->get_pawn_info(pos); + ei.pi = PawnTable[pos.thread()]->get_pawn_info(pos); ei.value += apply_weight(ei.pi->pawns_value(), Weights[PawnStructure]); // Initialize attack bitboards with pawns evaluation @@ -640,8 +636,6 @@ namespace { const Color Them = (Us == WHITE ? BLACK : WHITE); Bitboard b; - Value mg, eg; - int sente, threatCount = 0; Score bonus = make_score(0, 0); // Enemy pieces not defended by a pawn and under our attack @@ -660,20 +654,9 @@ namespace { if (b) for (PieceType pt2 = PAWN; pt2 < KING; pt2++) if (b & pos.pieces(pt2)) - { bonus += ThreatBonus[pt1][pt2]; - threatCount++; - } } - - sente = (Us == pos.side_to_move()); - - // Non linear threat evaluation. Increase threats score according to the - // number of concurrent threats and to the side to move. - mg = (mg_value(bonus) + mg_value(bonus) * ConcurrentThreatsWeight[sente] * threatCount / 256) * ThreatsWeight[sente] / 256; - eg = (eg_value(bonus) + eg_value(bonus) * ConcurrentThreatsWeight[sente] * threatCount / 256) * ThreatsWeight[sente] / 256; - - ei.value += Sign[Us] * make_score(mg, eg); + ei.value += Sign[Us] * bonus; } @@ -812,7 +795,6 @@ namespace { { Square s = pop_1st_bit(&b); - assert(pos.piece_on(s) == piece_of_color_and_type(Us, PAWN)); assert(pos.pawn_is_passed(Us, s)); int r = int(relative_rank(Us, s) - RANK_2);