Skip to content

Commit

Permalink
Add rook pair bonus
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 5, 2025
1 parent 4083bca commit 006031c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Lynx/Model/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,17 @@ public bool WasProduceByAValidMove()
packedScore -= BishopPairBonus;
}

// Rook pair bonus
if (PieceBitBoards[(int)Piece.R].CountBits() == 2)
{
packedScore += RookPairBonus;
}

if (PieceBitBoards[(int)Piece.r].CountBits() == 2)
{
packedScore -= RookPairBonus;
}

// Pieces attacked by pawns bonus
packedScore += PieceAttackedByPawnPenalty
* ((blackPawnAttacks & OccupancyBitBoards[(int)Side.White] /* & (~whitePawns) */).CountBits()
Expand Down
5 changes: 5 additions & 0 deletions src/Lynx/TunableEvalParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6048,6 +6048,11 @@ public static class EvaluationParams
/// </summary>
public const int BishopPairBonus = 4653086;

/// <summary>
/// <see cref="Utils.Pack(30, 71)"/>
/// </summary>
public const int RookPairBonus = 4653086;

/// <summary>
/// <see cref="Utils.Pack(-48, -33)"/>
/// </summary>
Expand Down

0 comments on commit 006031c

Please sign in to comment.