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:
Marco Costalba
2009-11-02 18:27:26 +01:00
parent 53c2bf0697
commit deecb3757c
3 changed files with 62 additions and 62 deletions

View File

@@ -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);
}