Skip to content

Commit

Permalink
Make PieceProtectedByPawnBonus bucketed
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 6, 2025
1 parent 9790982 commit 3a00650
Show file tree
Hide file tree
Showing 2 changed files with 5,401 additions and 5,445 deletions.
6 changes: 3 additions & 3 deletions src/Lynx/Model/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public bool WasProduceByAValidMove()
// Bitboard copy that we 'empty'
var bitboard = PieceBitBoards[pieceIndex];

packedScore += PieceProtectedByPawnBonus[pieceIndex] * (whitePawnAttacks & bitboard).CountBits();
packedScore += PieceProtectedByPawnBonus[whiteBucket][pieceIndex] * (whitePawnAttacks & bitboard).CountBits();

while (bitboard != default)
{
Expand All @@ -447,7 +447,7 @@ public bool WasProduceByAValidMove()
var bitboard = PieceBitBoards[pieceIndex];

// Pieces protected by pawns bonus
packedScore -= PieceProtectedByPawnBonus[pieceIndex - 6] * (blackPawnAttacks & bitboard).CountBits();
packedScore -= PieceProtectedByPawnBonus[blackBucket][pieceIndex - 6] * (blackPawnAttacks & bitboard).CountBits();

while (bitboard != default)
{
Expand Down Expand Up @@ -673,7 +673,7 @@ private int PawnAdditionalEvaluation(int bucket, int squareIndex, int pieceIndex
// Pawn phalanx
if (Constants.File[squareIndex] != 7 && PieceBitBoards[pieceIndex].GetBit(squareIndex + 1))
{
packedBonus += PawnPhalanxBonus[bucket][rank];
packedBonus += PawnPhalanxBonus[rank];
}

return packedBonus;
Expand Down
Loading

0 comments on commit 3a00650

Please sign in to comment.