diff options
| author | Mario Lang <mlang@delysid.org> | 2014-04-25 23:47:03 +0200 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2014-04-25 23:47:03 +0200 |
| commit | 509a1421626f7cfb19cf8c3048a8c8b93841923c (patch) | |
| tree | 604b8f934409dbdc5756fd2e71b57eaf1b012d1b /chess-ai.el | |
| parent | 3f99a7d6936a462a7fbd88d40baa1dd0139d26ef (diff) | |
chess-ai-eval-static: Avoid checking for mate if we just count mobility.
Diffstat (limited to 'chess-ai.el')
| -rw-r--r-- | chess-ai.el | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/chess-ai.el b/chess-ai.el index 5398df4..63fd9ab 100644 --- a/chess-ai.el +++ b/chess-ai.el @@ -139,45 +139,46 @@ this ply depth limit has been reached." chess-ai-passed-pawn)))) ;; Mobility (when chess-ai-mobility - (setq - v - (+ - v - (- - (+ - (if white-queens - (length (chess-legal-plies position :piece ?Q - :candidates white-queens)) - 0) - (if white-rooks - (length (chess-legal-plies position :piece ?R - :candidates white-rooks)) - 0) - (if white-bishops - (length (chess-legal-plies position :piece ?B - :candidates white-bishops)) - 0) - (if white-knights - (length (chess-legal-plies position :piece ?N - :candidates white-knights)) - 0)) + (let ((chess-ply-checking-mate t)) + (setq + v (+ - (if black-queens - (length (chess-legal-plies position :piece ?q - :candidates black-queens)) - 0) - (if black-rooks - (length (chess-legal-plies position :piece ?r - :candidates black-rooks)) - 0) - (if black-bishops - (length (chess-legal-plies position :piece ?b - :candidates black-bishops)) - 0) - (if black-knights - (length (chess-legal-plies position :piece ?n - :candidates black-knights)) - 0)))))) + v + (- + (+ + (if white-queens + (length (chess-legal-plies position :piece ?Q + :candidates white-queens)) + 0) + (if white-rooks + (length (chess-legal-plies position :piece ?R + :candidates white-rooks)) + 0) + (if white-bishops + (length (chess-legal-plies position :piece ?B + :candidates white-bishops)) + 0) + (if white-knights + (length (chess-legal-plies position :piece ?N + :candidates white-knights)) + 0)) + (+ + (if black-queens + (length (chess-legal-plies position :piece ?q + :candidates black-queens)) + 0) + (if black-rooks + (length (chess-legal-plies position :piece ?r + :candidates black-rooks)) + 0) + (if black-bishops + (length (chess-legal-plies position :piece ?b + :candidates black-bishops)) + 0) + (if black-knights + (length (chess-legal-plies position :piece ?n + :candidates black-knights)) + 0))))))) (if (chess-pos-side-to-move position) v |
