GetPromoPiece helper function | bench 1181803
This commit is contained in:
1 parent
7db4fcf59c
commit
68d7dcbccb
3 files changed
+12
-18
No files matched your search
+2
-7
@@ -424,11 +424,10 @@ void Board::MakeMove(Move move) {
|
|||||||
RemovePiece(attackerPiece, move.MoveFrom(), attackerColor);
|
RemovePiece(attackerPiece, move.MoveFrom(), attackerColor);
|
||||||
|
|
||||||
if (move.IsPromo()) {
|
if (move.IsPromo()) {
|
||||||
|
endPiece = move.GetPromoPiece();
|
||||||
if (move.IsCapture()) {
|
if (move.IsCapture()) {
|
||||||
endPiece = move.GetFlags() - 9;
|
|
||||||
Promote(move.MoveTo(), endPiece, sideToMove, true);
|
Promote(move.MoveTo(), endPiece, sideToMove, true);
|
||||||
} else {
|
} else {
|
||||||
endPiece = move.GetFlags() - 5;
|
|
||||||
Promote(move.MoveTo(), endPiece, sideToMove, false);
|
Promote(move.MoveTo(), endPiece, sideToMove, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -977,11 +976,7 @@ bool Board::GivesDirectCheck(Move &move) {
|
|||||||
int attackerType = nullPieceType;
|
int attackerType = nullPieceType;
|
||||||
|
|
||||||
if (move.IsPromo()) {
|
if (move.IsPromo()) {
|
||||||
if (move.IsCapture()) {
|
attackerType = move.GetPromoPiece();
|
||||||
attackerType = move.GetFlags() - 9;
|
|
||||||
} else {
|
|
||||||
attackerType = move.GetFlags() - 5;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
attackerType = GetPieceType(move.MoveFrom());
|
attackerType = GetPieceType(move.MoveFrom());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,6 +150,14 @@ public:
|
|||||||
return viriMove;
|
return viriMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetPromoPiece() {
|
||||||
|
if (IsCapture()) {
|
||||||
|
return GetFlags() - 9;
|
||||||
|
} else {
|
||||||
|
return GetFlags() - 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
operator uint16_t() {
|
operator uint16_t() {
|
||||||
return m_move;
|
return m_move;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-11
@@ -174,11 +174,7 @@ bool SEE(Board& board, Move& move, int threshold) {
|
|||||||
|
|
||||||
// Next victim is moved piece or promo piece
|
// Next victim is moved piece or promo piece
|
||||||
if (move.IsPromo()) {
|
if (move.IsPromo()) {
|
||||||
if (move.IsCapture()) {
|
nextVictim = move.GetPromoPiece();
|
||||||
nextVictim = move.GetFlags() - 9;
|
|
||||||
} else {
|
|
||||||
nextVictim = move.GetFlags() - 5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int balance = MoveEstimatedValue(board, move) - threshold;
|
int balance = MoveEstimatedValue(board, move) - threshold;
|
||||||
@@ -956,12 +952,7 @@ int MoveEstimatedValue(Board& board, Move& move) {
|
|||||||
int value = pieceType != nullPieceType ? SEEPieceValues[pieceType] : 0;
|
int value = pieceType != nullPieceType ? SEEPieceValues[pieceType] : 0;
|
||||||
|
|
||||||
if (move.IsPromo()) {
|
if (move.IsPromo()) {
|
||||||
int promoPiece = -1;
|
int promoPiece = move.GetPromoPiece();
|
||||||
if (move.IsCapture()) {
|
|
||||||
promoPiece = move.GetFlags() - 9;
|
|
||||||
} else {
|
|
||||||
promoPiece = move.GetFlags() - 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
value += SEEPieceValues[promoPiece] - SEEPieceValues[Pawn];
|
value += SEEPieceValues[promoPiece] - SEEPieceValues[Pawn];
|
||||||
} else if (move.GetFlags() == epCapture) {
|
} else if (move.GetFlags() == epCapture) {
|
||||||
|
|||||||
Reference in new issue
Block a user