dont update accumulators for no reason
bench: 1315668
This commit is contained in:
1 parent
f9e0f5db1a
commit
81a9a89ac8
1 file changed
+28
-13
+28
-13
@@ -394,6 +394,24 @@ void Board::MakeMove(Move move) {
|
|||||||
|
|
||||||
int endPiece = attackerPiece;
|
int endPiece = attackerPiece;
|
||||||
|
|
||||||
|
bool fullRecalc = false;
|
||||||
|
|
||||||
|
if (attackerPiece == King) {
|
||||||
|
const int toFile = move.MoveTo() % 8;
|
||||||
|
|
||||||
|
if (attackerColor == White) {
|
||||||
|
if ((toFile > 3) != accPair.mirroredWhite) {
|
||||||
|
accPair.mirroredWhite = !accPair.mirroredWhite;
|
||||||
|
fullRecalc = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((toFile > 3) != accPair.mirroredBlack) {
|
||||||
|
accPair.mirroredBlack = !accPair.mirroredBlack;
|
||||||
|
fullRecalc = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Removing attacker piece from old position
|
// Removing attacker piece from old position
|
||||||
RemovePiece(attackerPiece, move.MoveFrom(), attackerColor);
|
RemovePiece(attackerPiece, move.MoveFrom(), attackerColor);
|
||||||
|
|
||||||
@@ -407,6 +425,7 @@ void Board::MakeMove(Move move) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fullRecalc) {
|
||||||
if (move.IsCapture()) {
|
if (move.IsCapture()) {
|
||||||
if (move.GetFlags() != epCapture) {
|
if (move.GetFlags() != epCapture) {
|
||||||
accPair.addSubSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece, move.MoveTo(), targetPiece);
|
accPair.addSubSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece, move.MoveTo(), targetPiece);
|
||||||
@@ -418,6 +437,7 @@ void Board::MakeMove(Move move) {
|
|||||||
accPair.addSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece);
|
accPair.addSub(sideToMove, move.MoveTo(), endPiece, move.MoveFrom(), attackerPiece);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (move.GetFlags())
|
switch (move.GetFlags())
|
||||||
{
|
{
|
||||||
@@ -451,7 +471,10 @@ void Board::MakeMove(Move move) {
|
|||||||
|
|
||||||
SetPiece(attackerPiece, move.MoveTo(), attackerColor);
|
SetPiece(attackerPiece, move.MoveTo(), attackerColor);
|
||||||
|
|
||||||
|
if (!fullRecalc) {
|
||||||
accPair.addAddSubSub(sideToMove, move.MoveTo(), King, rookSquare - 2, Rook, move.MoveFrom(), King, rookSquare, Rook);
|
accPair.addAddSubSub(sideToMove, move.MoveTo(), King, rookSquare - 2, Rook, move.MoveFrom(), King, rookSquare, Rook);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case queenCastle:
|
case queenCastle:
|
||||||
@@ -465,28 +488,20 @@ void Board::MakeMove(Move move) {
|
|||||||
SetPiece(Rook, rookSquare + 3, attackerColor);
|
SetPiece(Rook, rookSquare + 3, attackerColor);
|
||||||
|
|
||||||
SetPiece(attackerPiece, move.MoveTo(), attackerColor);
|
SetPiece(attackerPiece, move.MoveTo(), attackerColor);
|
||||||
|
|
||||||
|
if (!fullRecalc) {
|
||||||
accPair.addAddSubSub(sideToMove, move.MoveTo(), King, rookSquare + 3, Rook, move.MoveFrom(), King, rookSquare, Rook);
|
accPair.addAddSubSub(sideToMove, move.MoveTo(), King, rookSquare + 3, Rook, move.MoveFrom(), King, rookSquare, Rook);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attackerPiece == King) {
|
if (fullRecalc) {
|
||||||
const int toFile = move.MoveTo() % 8;
|
|
||||||
|
|
||||||
if (attackerColor == White) {
|
|
||||||
if ((toFile > 3) != accPair.mirroredWhite) {
|
|
||||||
accPair.mirroredWhite = !accPair.mirroredWhite;
|
|
||||||
ResetAccPair();
|
ResetAccPair();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if ((toFile > 3) != accPair.mirroredBlack) {
|
|
||||||
accPair.mirroredBlack = !accPair.mirroredBlack;
|
|
||||||
ResetAccPair();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Removing the right to castle on king and rook movement
|
// Removing the right to castle on king and rook movement
|
||||||
UpdateCastlingRights(*this, move.MoveFrom(), attackerPiece, attackerColor);
|
UpdateCastlingRights(*this, move.MoveFrom(), attackerPiece, attackerColor);
|
||||||
|
|||||||
Reference in new issue
Block a user