Skip to content

Commit

Permalink
Hey, let's try
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 11, 2025
1 parent c084883 commit 983a729
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/Lynx/Model/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ public bool WasProduceByAValidMove()
var pieceSquareIndex = bitboard.GetLS1BIndex();
bitboard.ResetLS1B();

_incrementalEvalAccumulator += PSQT(0, whiteBucket, pieceIndex, pieceSquareIndex)
+ PSQT(1, blackBucket, pieceIndex, pieceSquareIndex);
_incrementalEvalAccumulator += PSQT(0, whiteBucket, pieceIndex, pieceSquareIndex);
_incrementalEvalAccumulator += PSQT(1, blackBucket, pieceIndex, pieceSquareIndex);

gamePhase += GamePhaseByPiece[pieceIndex];

Expand All @@ -647,8 +647,8 @@ public bool WasProduceByAValidMove()
var pieceSquareIndex = bitboard.GetLS1BIndex();
bitboard.ResetLS1B();

_incrementalEvalAccumulator += PSQT(0, blackBucket, pieceIndex, pieceSquareIndex)
+ PSQT(1, whiteBucket, pieceIndex, pieceSquareIndex);
_incrementalEvalAccumulator += PSQT(0, blackBucket, pieceIndex, pieceSquareIndex);
_incrementalEvalAccumulator += PSQT(1, whiteBucket, pieceIndex, pieceSquareIndex);

gamePhase += GamePhaseByPiece[pieceIndex];

Expand All @@ -657,19 +657,17 @@ public bool WasProduceByAValidMove()
}

// Kings
_incrementalEvalAccumulator +=
PSQT(0, whiteBucket, (int)Piece.K, whiteKing)
+ PSQT(1, blackBucket, (int)Piece.K, whiteKing)
+ PSQT(0, blackBucket, (int)Piece.k, blackKing)
+ PSQT(1, whiteBucket, (int)Piece.k, blackKing);
_incrementalEvalAccumulator += PSQT(0, whiteBucket, (int)Piece.K, whiteKing);
_incrementalEvalAccumulator += PSQT(1, blackBucket, (int)Piece.K, whiteKing);
_incrementalEvalAccumulator += PSQT(0, blackBucket, (int)Piece.k, blackKing);
_incrementalEvalAccumulator += PSQT(1, whiteBucket, (int)Piece.k, blackKing);

packedScore += _incrementalEvalAccumulator;
_isIncrementalEval = true;
}

packedScore +=
KingAdditionalEvaluation(whiteKing, (int)Side.White, blackPawnAttacks)
- KingAdditionalEvaluation(blackKing, (int)Side.Black, whitePawnAttacks);
packedScore += KingAdditionalEvaluation(whiteKing, (int)Side.White, blackPawnAttacks);
packedScore -= KingAdditionalEvaluation(blackKing, (int)Side.Black, whitePawnAttacks);

// Bishop pair bonus
if (PieceBitBoards[(int)Piece.B].CountBits() >= 2)
Expand Down

0 comments on commit 983a729

Please sign in to comment.