if (Pt == BISHOP)
{
// Penalty according to number of pawns on the same color square as the
- // bishop, bigger when the center files are blocked with pawns.
+ // bishop, bigger when the center files are blocked with pawns and smaller
+ // when the bishop is outside the pawn chain.
Bitboard blocked = pos.pieces(Us, PAWN) & shift<Down>(pos.pieces());
score -= BishopPawns * pos.pawns_on_same_color_squares(Us, s)
- * (1 + popcount(blocked & CenterFiles));
+ * (!bool(attackedBy[Us][PAWN] & s) + popcount(blocked & CenterFiles));
// Bonus for bishop on a long diagonal which can "see" both center squares
if (more_than_one(attacks_bb<BISHOP>(s, pos.pieces(PAWN)) & Center))
|| (pos.pieces(PAWN) & (s + Up)))
bonus = bonus / 2;
- score += bonus - PassedFile * map_to_queenside(file_of(s));
+ score += bonus - PassedFile * edge_distance(file_of(s));
}
if (T)
bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide)
&& (pos.pieces(PAWN) & KingSide);
- bool almostUnwinnable = !pe->passed_count()
- && outflanking < 0
+ bool almostUnwinnable = outflanking < 0
&& !pawnsOnBothFlanks;
bool infiltration = rank_of(pos.square<KING>(WHITE)) > RANK_4