constexpr Score CloseEnemies = S( 6, 0);
constexpr Score CorneredBishop = S( 50, 50);
constexpr Score Hanging = S( 57, 32);
- constexpr Score HinderPassedPawn = S( 8, 0);
constexpr Score KingProtector = S( 6, 6);
constexpr Score KnightOnQueen = S( 21, 11);
constexpr Score LongDiagonalBishop = S( 46, 0);
assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
- if (forward_file_bb(Us, s) & pos.pieces(Them))
- score -= HinderPassedPawn;
-
int r = relative_rank(Us, s);
int w = PassedDanger[r];
bonus += make_score(k * w, k * w);
}
- else if (pos.pieces(Us) & blockSq)
- bonus += make_score(w + r * 2, w + r * 2);
} // w != 0
// Scale down bonus for candidate passers which need more than one
int outflanking = distance<File>(pos.square<KING>(WHITE), pos.square<KING>(BLACK))
- distance<Rank>(pos.square<KING>(WHITE), pos.square<KING>(BLACK));
+ bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide)
+ && (pos.pieces(PAWN) & KingSide);
+
// Compute the initiative bonus for the attacking side
int complexity = 8 * pe->pawn_asymmetry()
+ 12 * pos.count<PAWN>()
+ 12 * outflanking
+ + 16 * pawnsOnBothFlanks
+ 48 * !pos.non_pawn_material()
- -110 ;
+ -118 ;
// Now apply the bonus: note that we find the attacking side by extracting
// the sign of the endgame value, and that we carefully cap the bonus so
if ( pos.opposite_bishops()
&& pos.non_pawn_material(WHITE) == BishopValueMg
&& pos.non_pawn_material(BLACK) == BishopValueMg)
- sf = 31;
+ sf = 8 + 4 * pe->pawn_asymmetry();
else
sf = std::min(40 + (pos.opposite_bishops() ? 2 : 7) * pos.count<PAWN>(strongSide), sf);
+
}
return ScaleFactor(sf);