Greatly speedup has_mate_threat()

Instead of loop across all legal moves to find a mate
loop across possible check moves only.

This reduces more then 10 times the number of moves to
check for a possible mate.

Also rename generate_checks() in generate_non_capture_checks()
so to better clarify what the function does.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2009-04-20 09:10:27 +02:00
parent 24485c96ec
commit 7c267587fc
4 changed files with 18 additions and 17 deletions

View File

@@ -34,7 +34,7 @@
extern int generate_captures(const Position& pos, MoveStack* mlist);
extern int generate_noncaptures(const Position& pos, MoveStack* mlist);
extern int generate_checks(const Position& pos, MoveStack* mlist, Bitboard dc);
extern int generate_non_capture_checks(const Position& pos, MoveStack* mlist, Bitboard dc);
extern int generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned);
extern int generate_legal_moves(const Position& pos, MoveStack* mlist);
extern bool move_is_legal(const Position& pos, const Move m, Bitboard pinned);