Skip to content

Commit

Permalink
only if relative rank > 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MJZ1977 committed Apr 11, 2019
1 parent 968e164 commit 3ab5ef3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/evaluate.cpp
Expand Up @@ -501,6 +501,8 @@ namespace {
constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH);
constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB);

const Square ksq = pos.square<KING>(Us);

Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe;
Score score = SCORE_ZERO;

Expand Down Expand Up @@ -595,8 +597,9 @@ namespace {
}

// Bonus for king supporting pawn majority
if (popcount(pos.pieces(Us,PAWN) & KingFlank[file_of(pos.square<KING>(Us))]) >
popcount(pos.pieces(Them,PAWN) & KingFlank[file_of(pos.square<KING>(Us))]) + 1)
if (relative_rank(Us, ksq) > RANK_2
&& (popcount(pos.pieces(Us,PAWN) & KingFlank[file_of(ksq)]) >
popcount(pos.pieces(Them,PAWN) & KingFlank[file_of(ksq)]) + 1))
score += make_score(0, 6);

if (T)
Expand Down

0 comments on commit 3ab5ef3

Please sign in to comment.