mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +08:00
Reintroduce the old "trapped bishop in the corner" evaluation term
for Chess960 games. After 1918 games at 30" Mod - Orig: 1052-866 (+532,-346,=1040), Elo +33.8
This commit is contained in:
@@ -168,6 +168,11 @@ namespace {
|
||||
// right to castle.
|
||||
const Value TrappedRookPenalty = Value(180);
|
||||
|
||||
// Penalty for a bishop on a1/h1 (a8/h8 for black) which is trapped by
|
||||
// a friendly pawn on b2/g2 (b7/g7 for black). This can obviously only
|
||||
// happen in Chess960 games.
|
||||
const Score TrappedBishopA1H1Penalty = make_score(100, 100);
|
||||
|
||||
// The SpaceMask[Color] contains the area of the board which is considered
|
||||
// by the space evaluation. In the middle game, each side is given a bonus
|
||||
// based on how many squares inside this area are safe and available for
|
||||
@@ -556,6 +561,28 @@ namespace {
|
||||
bonus += (Piece == ROOK ? RookOn7thBonus : QueenOn7thBonus);
|
||||
}
|
||||
|
||||
// Special extra evaluation for bishops
|
||||
if (Piece == BISHOP)
|
||||
{
|
||||
// An important Chess960 pattern: A cornered bishop blocked by
|
||||
// a friendly pawn diagonally in front of it is a very serious
|
||||
// problem, especially when that pawn is also blocked.
|
||||
if (s == relative_square(Us, SQ_A1) || s == relative_square(Us, SQ_H1))
|
||||
{
|
||||
SquareDelta d = pawn_push(Us)
|
||||
+ (square_file(s) == FILE_A ? DELTA_E : DELTA_W);
|
||||
if (pos.piece_on(s + d) == piece_of_color_and_type(Us, PAWN))
|
||||
{
|
||||
if (!pos.square_is_empty(s + d + pawn_push(Us)))
|
||||
bonus -= 2*TrappedBishopA1H1Penalty;
|
||||
else if (pos.piece_on(s + 2*d) == piece_of_color_and_type(Us, PAWN))
|
||||
bonus -= TrappedBishopA1H1Penalty;
|
||||
else
|
||||
bonus -= TrappedBishopA1H1Penalty / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Special extra evaluation for rooks
|
||||
if (Piece == ROOK)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user