mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-25 19:46:55 +08:00
Fixed compilation errors.
This commit is contained in:
@@ -1028,102 +1028,3 @@ std::string Eval::trace(const Position& pos) {
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
// Check whether the pieceListFw[] held internally is a correct PieceSquare.
|
||||
// Note: For debugging. slow.
|
||||
bool EvalList::is_valid(const Position& pos)
|
||||
{
|
||||
std::set<PieceId> piece_numbers;
|
||||
for (Square sq = SQ_A1; sq != SQUARE_NB; ++sq) {
|
||||
auto piece_number = piece_id_list[sq];
|
||||
if (piece_number == PieceId::PIECE_ID_NONE) {
|
||||
continue;
|
||||
}
|
||||
assert(!piece_numbers.count(piece_number));
|
||||
piece_numbers.insert(piece_number);
|
||||
}
|
||||
|
||||
for (int i = 0; i < PieceId::PIECE_ID_KING; ++i)
|
||||
{
|
||||
PieceSquare fw = pieceListFw[i];
|
||||
// Go to the Position class to see if this fw really exists.
|
||||
|
||||
if (fw == PieceSquare::PS_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Out of range
|
||||
if (!(0 <= fw && fw < PieceSquare::PS_END))
|
||||
return false;
|
||||
|
||||
// Since it is a piece on the board, I will check if this piece really exists.
|
||||
for (Piece pc = NO_PIECE; pc < PIECE_NB; ++pc)
|
||||
{
|
||||
auto pt = type_of(pc);
|
||||
if (pt == NO_PIECE_TYPE || pt == 7) // non-existing piece
|
||||
continue;
|
||||
|
||||
// PieceSquare start number of piece pc
|
||||
auto s = PieceSquare(kpp_board_index[pc].from[Color::WHITE]);
|
||||
if (s <= fw && fw < s + SQUARE_NB)
|
||||
{
|
||||
// Since it was found, check if this piece is at sq.
|
||||
Square sq = (Square)(fw - s);
|
||||
Piece pc2 = pos.piece_on(sq);
|
||||
|
||||
if (pc2 != pc)
|
||||
return false;
|
||||
|
||||
goto Found;
|
||||
}
|
||||
}
|
||||
// It was a piece that did not exist for some reason..
|
||||
return false;
|
||||
Found:;
|
||||
}
|
||||
|
||||
// Validate piece_id_list
|
||||
for (auto sq = SQUARE_ZERO; sq < SQUARE_NB; ++sq) {
|
||||
Piece expected_piece = pos.piece_on(sq);
|
||||
PieceId piece_number = piece_id_list[sq];
|
||||
if (piece_number == PieceId::PIECE_ID_NONE) {
|
||||
assert(expected_piece == NO_PIECE);
|
||||
if (expected_piece != NO_PIECE) {
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
PieceSquare bona_piece_white = pieceListFw[piece_number];
|
||||
Piece actual_piece;
|
||||
for (actual_piece = NO_PIECE; actual_piece < PIECE_NB; ++actual_piece) {
|
||||
if (kpp_board_index[actual_piece].from[Color::WHITE] == PieceSquare::PS_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (kpp_board_index[actual_piece].from[Color::WHITE] <= bona_piece_white
|
||||
&& bona_piece_white < kpp_board_index[actual_piece].from[Color::WHITE] + SQUARE_NB) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert(actual_piece != PIECE_NB);
|
||||
if (actual_piece == PIECE_NB) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(actual_piece == expected_piece);
|
||||
if (actual_piece != expected_piece) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Square actual_square = static_cast<Square>(
|
||||
bona_piece_white - kpp_board_index[actual_piece].from[Color::WHITE]);
|
||||
assert(sq == actual_square);
|
||||
if (sq != actual_square) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user