summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2014-04-18 13:51:46 +0200
committerMario Lang <mlang@delysid.org>2014-04-18 13:51:46 +0200
commitb6158eb0043e06b8b8db7b43d41914974c4c87a3 (patch)
treeed99fee5967e41b55f9a661d796df55a27f86a44
parenta21f71e45ebf234601b01d0121d067f14a6b848c (diff)
chess-perft: Simplify en-passant checks.
-rw-r--r--chess-perft.el28
1 files changed, 2 insertions, 26 deletions
diff --git a/chess-perft.el b/chess-perft.el
index b055d2c..8aa109f 100644
--- a/chess-perft.el
+++ b/chess-perft.el
@@ -63,36 +63,12 @@ The result is a list of the form
(or (chess-pos-piece-p
(chess-ply-pos ply) (chess-ply-target ply)
(not (chess-pos-side-to-move (chess-ply-pos ply))))
- (let ((en-passant (chess-pos-en-passant
- (chess-ply-pos ply))))
- (and en-passant
- (chess-pos-piece-p (chess-ply-pos ply)
- en-passant
- (not
- (chess-pos-side-to-move
- (chess-ply-pos ply))))
- (/= (chess-ply-target ply) en-passant)
- (/= (chess-pos-piece
- (chess-ply-pos ply) en-passant)
- (chess-pos-piece
- (chess-ply-next-pos ply) en-passant))))))
+ (chess-ply-keyword ply :en-passant)))
plies)
;; En passants
(cl-count-if
(lambda (ply)
- (let ((en-passant (chess-pos-en-passant
- (chess-ply-pos ply))))
- (and en-passant
- (chess-pos-piece-p (chess-ply-pos ply)
- en-passant
- (not
- (chess-pos-side-to-move
- (chess-ply-pos ply))))
- (/= (chess-ply-target ply) en-passant)
- (/= (chess-pos-piece
- (chess-ply-pos ply) en-passant)
- (chess-pos-piece
- (chess-ply-next-pos ply) en-passant)))))
+ (chess-ply-keyword ply :en-passant))
plies)
;; Castles
(cl-count-if