constexpr Score KnightOnQueen = S( 16, 12);
constexpr Score LongDiagonalBishop = S( 45, 0);
constexpr Score MinorBehindPawn = S( 18, 3);
- constexpr Score Outpost = S( 16, 5);
+ constexpr Score Outpost = S( 32, 10);
constexpr Score PassedFile = S( 11, 8);
constexpr Score PawnlessFlank = S( 17, 95);
constexpr Score RestrictedPiece = S( 7, 7);
// Bonus if piece is on an outpost square or can reach one
bb = OutpostRanks & attackedBy[Us][PAWN] & ~pe->pawn_attacks_span(Them);
if (bb & s)
- score += Outpost * (Pt == KNIGHT ? 4 : 2);
-
- else if (bb & b & ~pos.pieces(Us))
score += Outpost * (Pt == KNIGHT ? 2 : 1);
+ else if (Pt == KNIGHT && bb & b & ~pos.pieces(Us))
+ score += Outpost;
+
// Knight and Bishop bonus for being right behind a pawn
if (shift<Down>(pos.pieces(PAWN)) & s)
score += MinorBehindPawn;
int kingFlankAttacks = popcount(b1) + popcount(b2);
kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
- + 69 * kingAttacksCount[Them]
+ 185 * popcount(kingRing[Us] & weak)
- - 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
- - 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING])
+ 148 * popcount(unsafeChecks)
+ 98 * popcount(pos.blockers_for_king(Us))
+ + 69 * kingAttacksCount[Them]
+ + 3 * kingFlankAttacks * kingFlankAttacks / 8
+ + mg_value(mobility[Them] - mobility[Us])
- 873 * !pos.count<QUEEN>(Them)
+ - 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
+ - 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING])
- 6 * mg_value(score) / 8
- + mg_value(mobility[Them] - mobility[Us])
- + 3 * kingFlankAttacks * kingFlankAttacks / 8
- 7;
// Transform the kingDanger units into a Score, and subtract it from the evaluation
assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
int r = relative_rank(Us, s);
- File f = file_of(s);
Score bonus = PassedRank[r];
|| (pos.pieces(PAWN) & (s + Up)))
bonus = bonus / 2;
- score += bonus - PassedFile * map_to_queenside(f);
+ score += bonus - PassedFile * map_to_queenside(file_of(s));
}
if (T)
else
sf = std::min(sf, 36 + (pos.opposite_bishops() ? 2 : 7) * pos.count<PAWN>(strongSide));
- sf = std::max(0, sf - (pos.rule50_count() - 12) / 4 );
+ sf = std::max(0, sf - (pos.rule50_count() - 12) / 4);
}
return ScaleFactor(sf);