mbonus += rr + r * 2, ebonus += rr + r * 2;
} // rr != 0
- // Assign a small bonus when the opponent has no pieces left
- if (!pos.non_pawn_material(Them))
- ebonus += 20;
-
// Scale down bonus for candidate passers which need more than one pawn
// push to become passed.
if (!pos.pawn_passed(Us, s + pawn_push(Us)))
// If we don't already have an unusual scale factor, check for certain
// types of endgames, and use a lower scale for those.
- if ( ei.me->game_phase() < PHASE_MIDGAME
- && (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN))
+ if (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN)
{
if (pos.opposite_bishops())
{
// is almost a draw, in case of KBP vs KB, it 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);
+ return 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);
+ return ScaleFactor(46);
}
// Endings where weaker side can place his king in front of the opponent's
// pawns are drawish.
else if ( abs(eg) <= BishopValueEg
&& pos.count<PAWN>(strongSide) <= 2
&& !pos.pawn_passed(~strongSide, pos.square<KING>(~strongSide)))
- sf = ScaleFactor(37 + 7 * pos.count<PAWN>(strongSide));
+ return ScaleFactor(37 + 7 * pos.count<PAWN>(strongSide));
}
return sf;