@@ -229,7 +229,7 @@ namespace {
229229
230230 // Function prototypes
231231 template <bool Trace>
232- Value do_evaluate (const Position& pos, Value& margin );
232+ Value do_evaluate (const Position& pos);
233233
234234 template <Color Us>
235235 void init_eval_info (const Position& pos, EvalInfo& ei);
@@ -238,7 +238,7 @@ namespace {
238238 Score evaluate_pieces_of_color (const Position& pos, EvalInfo& ei, Score* mobility);
239239
240240 template <Color Us, bool Trace>
241- Score evaluate_king (const Position& pos, const EvalInfo& ei, Value margins[] );
241+ Score evaluate_king (const Position& pos, const EvalInfo& ei);
242242
243243 template <Color Us, bool Trace>
244244 Score evaluate_threats (const Position& pos, const EvalInfo& ei);
@@ -264,8 +264,8 @@ namespace Eval {
264264 // / values, an endgame score and a middle game score, and interpolates
265265 // / between them based on the remaining material.
266266
267- Value evaluate (const Position& pos, Value& margin ) {
268- return do_evaluate<false >(pos, margin );
267+ Value evaluate (const Position& pos) {
268+ return do_evaluate<false >(pos);
269269 }
270270
271271
@@ -307,19 +307,14 @@ namespace Eval {
307307namespace {
308308
309309template <bool Trace>
310- Value do_evaluate (const Position& pos, Value& margin ) {
310+ Value do_evaluate (const Position& pos) {
311311
312312 assert (!pos.checkers ());
313313
314314 EvalInfo ei;
315- Value margins[COLOR_NB];
316315 Score score, mobility[2 ] = { SCORE_ZERO, SCORE_ZERO };
317316 Thread* th = pos.this_thread ();
318317
319- // margins[] store the uncertainty estimation of position's evaluation
320- // that typically is used by the search for pruning decisions.
321- margins[WHITE] = margins[BLACK] = VALUE_ZERO;
322-
323318 // Initialize score by reading the incrementally updated scores included
324319 // in the position object (material + piece square tables) and adding
325320 // Tempo bonus. Score is computed from the point of view of white.
@@ -332,10 +327,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
332327 // If we have a specialized evaluation function for the current material
333328 // configuration, call it and return.
334329 if (ei.mi ->specialized_eval_exists ())
335- {
336- margin = VALUE_ZERO;
337330 return ei.mi ->evaluate (pos);
338- }
339331
340332 // Probe the pawn hash table
341333 ei.pi = Pawns::probe (pos, th->pawnsTable );
@@ -353,8 +345,8 @@ Value do_evaluate(const Position& pos, Value& margin) {
353345
354346 // Evaluate kings after all other pieces because we need complete attack
355347 // information when computing the king safety evaluation.
356- score += evaluate_king<WHITE, Trace>(pos, ei, margins )
357- - evaluate_king<BLACK, Trace>(pos, ei, margins );
348+ score += evaluate_king<WHITE, Trace>(pos, ei)
349+ - evaluate_king<BLACK, Trace>(pos, ei);
358350
359351 // Evaluate tactical threats, we need full attack information including king
360352 score += evaluate_threats<WHITE, Trace>(pos, ei)
@@ -401,7 +393,6 @@ Value do_evaluate(const Position& pos, Value& margin) {
401393 sf = ScaleFactor (50 );
402394 }
403395
404- margin = margins[pos.side_to_move ()];
405396 Value v = interpolate (score, ei.mi ->game_phase (), sf);
406397
407398 // In case of tracing add all single evaluation contributions for both white and black
@@ -414,9 +405,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
414405 Score b = ei.mi ->space_weight () * evaluate_space<BLACK>(pos, ei);
415406 Tracing::add (SPACE, apply_weight (w, Weights[Space]), apply_weight (b, Weights[Space]));
416407 Tracing::add (TOTAL, score);
417- Tracing::stream << " \n Uncertainty margin: White: " << to_cp (margins[WHITE])
418- << " , Black: " << to_cp (margins[BLACK])
419- << " \n Scaling: " << std::noshowpos
408+ Tracing::stream << " \n Scaling: " << std::noshowpos
420409 << std::setw (6 ) << 100.0 * ei.mi ->game_phase () / 128.0 << " % MG, "
421410 << std::setw (6 ) << 100.0 * (1.0 - ei.mi ->game_phase () / 128.0 ) << " % * "
422411 << std::setw (6 ) << (100.0 * sf) / SCALE_FACTOR_NORMAL << " % EG.\n "
@@ -640,7 +629,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
640629 // evaluate_king() assigns bonuses and penalties to a king of a given color
641630
642631 template <Color Us, bool Trace>
643- Score evaluate_king (const Position& pos, const EvalInfo& ei, Value margins[] ) {
632+ Score evaluate_king (const Position& pos, const EvalInfo& ei) {
644633
645634 const Color Them = (Us == WHITE ? BLACK : WHITE);
646635
@@ -735,12 +724,8 @@ Value do_evaluate(const Position& pos, Value& margin) {
735724 attackUnits = std::min (99 , std::max (0 , attackUnits));
736725
737726 // Finally, extract the king danger score from the KingDanger[]
738- // array and subtract the score from evaluation. Set also margins[]
739- // value that will be used for pruning because this value can sometimes
740- // be very big, and so capturing a single attacking piece can therefore
741- // result in a score change far bigger than the value of the captured piece.
727+ // array and subtract the score from evaluation.
742728 score -= KingDanger[Us == Search::RootColor][attackUnits];
743- margins[Us] += mg_value (KingDanger[Us == Search::RootColor][attackUnits]);
744729 }
745730
746731 if (Trace)
@@ -1024,8 +1009,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
10241009 stream << std::showpoint << std::showpos << std::fixed << std::setprecision (2 );
10251010 std::memset (scores, 0 , 2 * (TOTAL + 1 ) * sizeof (Score));
10261011
1027- Value margin;
1028- do_evaluate<true >(pos, margin);
1012+ do_evaluate<true >(pos);
10291013
10301014 std::string totals = stream.str ();
10311015 stream.str (" " );
0 commit comments