1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-01 01:03:09 +00:00

Code style clean-up

This piece of code needs some love.

No functional change.
This commit is contained in:
Marco Costalba 2014-10-30 12:32:43 +01:00
parent 5605cc7684
commit 460892382a

View file

@ -766,27 +766,25 @@ namespace {
if ( ei.mi->game_phase() < PHASE_MIDGAME if ( ei.mi->game_phase() < PHASE_MIDGAME
&& (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN)) && (sf == SCALE_FACTOR_NORMAL || sf == SCALE_FACTOR_ONEPAWN))
{ {
if (pos.opposite_bishops()) { if (pos.opposite_bishops())
// Ignoring any pawns, do both sides only have a single bishop and no {
// other pieces? // 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 if ( pos.non_pawn_material(WHITE) == BishopValueMg
&& pos.non_pawn_material(BLACK) == BishopValueMg) && pos.non_pawn_material(BLACK) == BishopValueMg)
{ sf = more_than_one(pos.pieces(PAWN)) ? ScaleFactor(32) : ScaleFactor(8);
// Check for KBP vs KB with only a single pawn that is almost
// certainly a draw or at least two pawns. // Endgame with opposite-colored bishops, but also other pieces. Still
bool one_pawn = (pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK) == 1); // a bit drawish, but not as drawish as with only the two bishops.
sf = one_pawn ? ScaleFactor(8) : ScaleFactor(32);
}
else else
// Endgame with opposite-colored bishops, but also other pieces. Still
// a bit drawish, but not as drawish as with only the two bishops.
sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL); sf = ScaleFactor(50 * sf / SCALE_FACTOR_NORMAL);
} else if ( abs(eg_value(score)) <= BishopValueEg
&& ei.pi->pawn_span(strongSide) <= 1
&& !pos.pawn_passed(~strongSide, pos.king_square(~strongSide))) {
// Endings where weaker side can be place his king in front of the opponent's pawns are drawish.
sf = ScaleFactor(ScalePawnSpan[ei.pi->pawn_span(strongSide)]);
} }
// 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.king_square(~strongSide)))
sf = ScaleFactor(ScalePawnSpan[ei.pi->pawn_span(strongSide)]);
} }
// Interpolate between a middlegame and a (scaled by 'sf') endgame score // Interpolate between a middlegame and a (scaled by 'sf') endgame score