X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=4a0075cb841845bff231bd8a8091404b16ea7b5e;hp=4e9a6dc7b02388ddae1c8224a9bfd8eeedea2368;hb=12461996a5bb6d4c07d4b7e464924eaaa406b01d;hpb=64d6ba2e98f29db8e853071b635ae4ebd59c24f0 diff --git a/src/position.cpp b/src/position.cpp index 4e9a6dc7..4a0075cb 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1338,6 +1338,7 @@ int Position::see(Square from, Square to) const { Bitboard attackers, stmAttackers, b; + assert(!shortcut || from != SQ_NONE); assert(square_is_ok(from) || from == SQ_NONE); assert(square_is_ok(to)); @@ -1350,6 +1351,10 @@ int Position::see(Square from, Square to) const { Piece capture = piece_on(to); Bitboard occ = occupied_squares(); + // King cannot be recaptured + if (type_of_piece(piece) == KING) + return seeValues[capture]; + // Handle en passant moves if (st->epSquare == to && type_of_piece_on(from) == PAWN) { @@ -1488,8 +1493,8 @@ void Position::clear() { for (int i = 0; i < 64; i++) board[i] = EMPTY; - for (int i = 0; i < 7; i++) - for (int j = 0; j < 8; j++) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 16; j++) pieceList[0][i][j] = pieceList[1][i][j] = SQ_NONE; sideToMove = WHITE;