Skip to content

Commit

Permalink
Simplify code, delete else after return
Browse files Browse the repository at this point in the history
  • Loading branch information
Miroslav Fontán authored and mcostalba committed Nov 5, 2016
1 parent f3cd700 commit 445aade
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/endgame.cpp
Expand Up @@ -652,17 +652,15 @@ ScaleFactor Endgame<KBPKB>::operator()(const Position& pos) const {

if (relative_rank(strongSide, pawnSq) <= RANK_5)
return SCALE_FACTOR_DRAW;
else
{
Bitboard path = forward_bb(strongSide, pawnSq);

Bitboard path = forward_bb(strongSide, pawnSq);

if (path & pos.pieces(weakSide, KING))
return SCALE_FACTOR_DRAW;
if (path & pos.pieces(weakSide, KING))
return SCALE_FACTOR_DRAW;

if ( (pos.attacks_from<BISHOP>(weakBishopSq) & path)
&& distance(weakBishopSq, pawnSq) >= 3)
return SCALE_FACTOR_DRAW;
}
if ( (pos.attacks_from<BISHOP>(weakBishopSq) & path)
&& distance(weakBishopSq, pawnSq) >= 3)
return SCALE_FACTOR_DRAW;
}
return SCALE_FACTOR_NONE;
}
Expand Down

0 comments on commit 445aade

Please sign in to comment.