mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-16 23:26:23 +08:00
Generate pseudo-legal moves in generate_evasions()
This allow a big semplification in move generation that will be committed with the next patch. And makes handling of evasions similar to the other type of moves. This patch plus the next seem to improve also on the performance side because after 640 games to verify there are no hidden regressions we are at +9 ELO Verified with perft no functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -470,7 +470,6 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
|
||||
assert(is_ok());
|
||||
assert(move_is_ok(m));
|
||||
assert(pinned == pinned_pieces(side_to_move()));
|
||||
assert(!is_check());
|
||||
|
||||
// Castling moves are checked for legality during move generation.
|
||||
if (move_is_castle(m))
|
||||
@@ -482,7 +481,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
|
||||
assert(color_of_piece_on(from) == us);
|
||||
assert(piece_on(king_square(us)) == piece_of_color_and_type(us, KING));
|
||||
|
||||
// En passant captures are a tricky special case. Because they are
|
||||
// En passant captures are a tricky special case. Because they are
|
||||
// rather uncommon, we do it simply by testing whether the king is attacked
|
||||
// after the move is made
|
||||
if (move_is_ep(m))
|
||||
@@ -1706,8 +1705,7 @@ bool Position::is_draw() const {
|
||||
bool Position::is_mate() const {
|
||||
|
||||
MoveStack moves[256];
|
||||
|
||||
return is_check() && (generate_evasions(*this, moves, pinned_pieces(sideToMove)) == moves);
|
||||
return is_check() && (generate_moves(*this, moves, false) == moves);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user