using NNUE eval | bench 10737067
This commit is contained in:
1 parent
d72a0c341e
commit
2ea6bd1c64
8 files changed
+109
-44
No files matched your search
+32
-30
@@ -278,9 +278,33 @@ bool Board::MakeMove(Move move) {
|
||||
int targetPiece = GetPieceType(move.MoveTo());
|
||||
int direction = attackerColor ? south : north;
|
||||
|
||||
int endPiece = attackerPiece;
|
||||
|
||||
// Removing attacker piece from old position
|
||||
RemovePiece(attackerPiece, move.MoveFrom(), attackerColor);
|
||||
|
||||
if (move.IsPromo()) {
|
||||
if (move.IsCapture()) {
|
||||
endPiece = move.GetFlags() - 9;
|
||||
Promote(move.MoveTo(), endPiece, sideToMove, true);
|
||||
} else {
|
||||
endPiece = move.GetFlags() - 5;
|
||||
Promote(move.MoveTo(), endPiece, sideToMove, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (move.IsCapture()) {
|
||||
if (move.GetFlags() != epCapture) {
|
||||
accPair.addSubSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece, move.MoveTo(), targetPiece);
|
||||
} else {
|
||||
accPair.addSubSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece, enPassantTarget, Pawn);
|
||||
}
|
||||
} else {
|
||||
if (move.GetFlags() != kingCastle && move.GetFlags() != queenCastle) {
|
||||
accPair.addSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece);
|
||||
}
|
||||
}
|
||||
|
||||
switch (move.GetFlags())
|
||||
{
|
||||
case quiet:
|
||||
@@ -312,6 +336,8 @@ bool Board::MakeMove(Move move) {
|
||||
SetPiece(Rook, rookSquare - 2, attackerColor);
|
||||
|
||||
SetPiece(attackerPiece, move.MoveTo(), attackerColor);
|
||||
|
||||
accPair.addAddSubSub(sideToMove, move.MoveTo(), King, rookSquare - 2, Rook, move.MoveFrom(), King, rookSquare, Rook);
|
||||
break;
|
||||
}
|
||||
case queenCastle:
|
||||
@@ -325,32 +351,9 @@ bool Board::MakeMove(Move move) {
|
||||
SetPiece(Rook, rookSquare + 3, attackerColor);
|
||||
|
||||
SetPiece(attackerPiece, move.MoveTo(), attackerColor);
|
||||
accPair.addAddSubSub(sideToMove, move.MoveTo(), King, rookSquare + 3, Rook, move.MoveFrom(), King, rookSquare, Rook);
|
||||
break;
|
||||
}
|
||||
case knightPromotion:
|
||||
Promote(move.MoveTo(), Knight, attackerColor, false);
|
||||
break;
|
||||
case bishopPromotion:
|
||||
Promote(move.MoveTo(), Bishop, attackerColor, false);
|
||||
break;
|
||||
case rookPromotion:
|
||||
Promote(move.MoveTo(), Rook, attackerColor, false);
|
||||
break;
|
||||
case queenPromotion:
|
||||
Promote(move.MoveTo(), Queen, attackerColor, false);
|
||||
break;
|
||||
case knightPromoCapture:
|
||||
Promote(move.MoveTo(), Knight, attackerColor, true);
|
||||
break;
|
||||
case bishopPromoCapture:
|
||||
Promote(move.MoveTo(), Bishop, attackerColor, true);
|
||||
break;
|
||||
case rookPromoCapture:
|
||||
Promote(move.MoveTo(), Rook, attackerColor, true);
|
||||
break;
|
||||
case queenPromoCapture:
|
||||
Promote(move.MoveTo(), Queen, attackerColor, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -370,7 +373,6 @@ bool Board::MakeMove(Move move) {
|
||||
}
|
||||
|
||||
enPassantTarget = newEpTarget;
|
||||
|
||||
|
||||
MOVEGEN::GenThreatMaps(*this);
|
||||
|
||||
@@ -387,7 +389,7 @@ bool Board::MakeMove(Move move) {
|
||||
} else {
|
||||
halfMoves++;
|
||||
}
|
||||
|
||||
|
||||
positionIndex++;
|
||||
positionHistory[positionIndex] = hashKey;
|
||||
|
||||
@@ -416,8 +418,8 @@ void Board::ResetAccPair() {
|
||||
while (whitePieces) {
|
||||
int square = whitePieces.getLS1BIndex();
|
||||
|
||||
int wInput = ACC::CalculateIndex(White, square, GetPieceType(square), White);
|
||||
int bInput = ACC::CalculateIndex(Black, square, GetPieceType(square), White);
|
||||
int wInput = ACC::CalculateIndex(White, White, GetPieceType(square), square);
|
||||
int bInput = ACC::CalculateIndex(Black, White, GetPieceType(square), square);
|
||||
|
||||
for (int i = 0; i < NNUE::HL_SIZE; i++) {
|
||||
accPair.white.values[i] += NNUE::net.accumulator_weights[wInput * NNUE::HL_SIZE + i];
|
||||
@@ -430,8 +432,8 @@ void Board::ResetAccPair() {
|
||||
while (blackPieces) {
|
||||
int square = blackPieces.getLS1BIndex();
|
||||
|
||||
int wInput = ACC::CalculateIndex(White, square, GetPieceType(square), Black);
|
||||
int bInput = ACC::CalculateIndex(Black, square, GetPieceType(square), Black);
|
||||
int wInput = ACC::CalculateIndex(White, Black, GetPieceType(square), square);
|
||||
int bInput = ACC::CalculateIndex(Black, Black, GetPieceType(square), square);
|
||||
|
||||
for (int i = 0; i < NNUE::HL_SIZE; i++) {
|
||||
accPair.white.values[i] += NNUE::net.accumulator_weights[wInput * NNUE::HL_SIZE + i];
|
||||
|
||||
Reference in new issue
Block a user