- score += (evaluate_space<WHITE>(pos, ei) - evaluate_space<BLACK>(pos, ei)) * Weights[Space];
-
- // Evaluate initiative
- score += evaluate_initiative(pos, ei, score);
-
- // Scale winning side if position is more drawish than it appears
- Color strongSide = eg_value(score) > VALUE_DRAW ? WHITE : BLACK;
- ScaleFactor sf = me->scale_factor(pos, strongSide);
-
- // If we don't already have an unusual scale factor, check for certain
- // types of endgames, and use a lower scale for those.
- if ( me->game_phase() < PHASE_MIDGAME
- && (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN))
- {
- if (pos.opposite_bishops())
- {
- // Endgame with opposite-colored bishops and no other pieces (ignoring pawns)
- // is almost a draw, in case of KBP vs KB is even more a draw.
- if ( pos.non_pawn_material(WHITE) == BishopValueMg
- && pos.non_pawn_material(BLACK) == BishopValueMg)
- sf = more_than_one(pos.pieces(PAWN)) ? ScaleFactor(31) : ScaleFactor(9);
-
- // Endgame with opposite-colored bishops, but also other pieces. Still
- // a bit drawish, but not as drawish as with only the two bishops.
- else
- sf = ScaleFactor(46 * sf / SCALE_FACTOR_NORMAL);
- }
- // Endings where weaker side can place his king in front of the opponent's
- // pawns are drawish.
- else if ( abs(eg_value(score)) <= BishopValueEg
- && ei.pi->pawn_span(strongSide) <= 1
- && !pos.pawn_passed(~strongSide, pos.square<KING>(~strongSide)))
- sf = ei.pi->pawn_span(strongSide) ? ScaleFactor(51) : ScaleFactor(37);
- }
+ score += ( evaluate_space<WHITE>(pos, ei)
+ - evaluate_space<BLACK>(pos, ei)) * Weights[Space];
+
+ // Evaluate position potential for the winning side
+ score += evaluate_initiative(pos, ei.pi->pawn_asymmetry(), eg_value(score));
+
+ // Evaluate scale factor for the winning side
+ ScaleFactor sf = evaluate_scale_factor(pos, ei, score);