Skip to content

Commit

Permalink
Add KnightAttacksRooksBonus
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Nov 22, 2024
1 parent b921c36 commit 7a86eec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ static partial class EvaluationParams
/// <summary>
/// <see cref="Utils.Pack(1, 2)"/>
/// </summary>
public const int QueenAttackedByKnightBonus = 131073;
public const int KnightAttacksRooksBonus = 131073;

}
8 changes: 3 additions & 5 deletions src/Lynx/Model/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -733,11 +733,9 @@ private int KnightAdditionalEvaluation(int squareIndex, int pieceSide, int oppos
var checks = (attacks & enemyKingCheckThreats).CountBits();
packedBonus += CheckBonus[(int)Piece.N] * checks;

// Attacks to enemy queens
if ((attacks & PieceBitBoards[(int)Piece.q - Utils.PieceOffset(pieceSide)]) != 0)
{
packedBonus += KnightAttacksQueenBonus;
}
// Attacks to enemy rooks
var rookAttacksCount = (attacks & PieceBitBoards[(int)Piece.r - Utils.PieceOffset(pieceSide)]).CountBits();
packedBonus += KnightAttacksRooksBonus * rookAttacksCount;

return packedBonus;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lynx/TunableEvalParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6044,7 +6044,7 @@ public static partial class EvaluationParams
private static readonly int _PieceAttackedByPawnPenalty;

[GeneratedPack(1, 2)]
private static readonly int _KnightAttacksQueenBonus;
private static readonly int _KnightAttacksRooksBonus;

#pragma warning restore IDE0051, IDE0052, CS0169 // Remove unread private members

Expand Down

0 comments on commit 7a86eec

Please sign in to comment.