X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=375c2369a543e8d392b0e4c138f87af97c069fe2;hp=43ef3c4f66375a0f345fe05423c0b9a156bf8952;hb=7b721b3663920a2b74039ad6588ba4ed638c368b;hpb=b6ba5f7fe414e95c645fc31a989c1a4ed5fd423d diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 43ef3c4f..375c2369 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -229,10 +229,6 @@ namespace { MaterialInfoTable* MaterialTable[MAX_THREADS]; PawnInfoTable* PawnTable[MAX_THREADS]; - // Sizes of pawn and material hash tables - const int PawnTableSize = 16384; - const int MaterialTableSize = 1024; - // Function prototypes template Value do_evaluate(const Position& pos, EvalInfo& ei); @@ -268,6 +264,14 @@ namespace { //// Functions //// + +/// Prefetches in pawn hash tables + +void prefetchPawn(Key key, int threadID) { + + PawnTable[threadID]->prefetch(key); +} + /// 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. @@ -412,9 +416,9 @@ void init_eval(int threads) { continue; } if (!PawnTable[i]) - PawnTable[i] = new PawnInfoTable(PawnTableSize); + PawnTable[i] = new PawnInfoTable(); if (!MaterialTable[i]) - MaterialTable[i] = new MaterialInfoTable(MaterialTableSize); + MaterialTable[i] = new MaterialInfoTable(); } } @@ -682,15 +686,11 @@ namespace { Bitboard undefended, b, b1, b2, safe; bool sente; - int attackUnits, shelter = 0; + int attackUnits; const Square ksq = pos.king_square(Us); // King shelter - if (relative_rank(Us, ksq) <= RANK_4) - { - shelter = ei.pi->get_king_shelter(pos, Us, ksq); - ei.value += Sign[Us] * make_score(shelter, 0); - } + ei.value += Sign[Us] * ei.pi->king_shelter(pos, Us, ksq); // King safety. This is quite complicated, and is almost certainly far // from optimally tuned. @@ -717,7 +717,7 @@ namespace { attackUnits = Min(25, (ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them]) / 2) + 3 * (ei.kingAdjacentZoneAttacksCount[Them] + count_1s_max_15(undefended)) + InitKingDanger[relative_square(Us, ksq)] - - shelter / 32; + - mg_value(ei.pi->king_shelter(pos, Us, ksq)) / 32; // Analyse enemy's safe queen contact checks. First find undefended // squares around the king attacked by enemy queen... @@ -779,7 +779,7 @@ namespace { const Color Them = (Us == WHITE ? BLACK : WHITE); Bitboard squaresToQueen, defendedSquares, unsafeSquares, supportingPawns; - Bitboard b = ei.pi->passed_pawns() & pos.pieces_of_color(Us); + Bitboard b = ei.pi->passed_pawns(Us); while (b) {