summaryrefslogtreecommitdiff
path: root/chess-pos.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-11 01:36:27 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-11 01:36:27 +0000
commit899d559886410a9dca43ae793496c6384e381b43 (patch)
tree7e2bf3f21ef6151f93f671b1fa2a45cb1f72a101 /chess-pos.el
parentb95fa9f2840a8006b149e5a957228c91d3284dcf (diff)
*** no comment ***
Diffstat (limited to 'chess-pos.el')
-rw-r--r--chess-pos.el45
1 files changed, 23 insertions, 22 deletions
diff --git a/chess-pos.el b/chess-pos.el
index fdc5f6d..f326c09 100644
--- a/chess-pos.el
+++ b/chess-pos.el
@@ -278,28 +278,29 @@ trying to move a blank square."
;; if a king or rook moves, no more castling; also, if a pawn
;; jumps ahead two, mark it en-passantable
- (let ((piece (downcase (chess-pos-piece position (cadr changes)))))
- (cond
- ((and (= piece ?k)
- (equal (car changes)
- (chess-rf-to-index (if color 7 0) 4)))
- (chess-pos-set-can-castle position (if color ?K ?k) nil)
- (chess-pos-set-can-castle position (if color ?Q ?q) nil))
-
- ((and (= piece ?r)
- (equal (car changes)
- (chess-rf-to-index (if color 7 0) 0)))
- (chess-pos-set-can-castle position (if color ?Q ?q) nil))
-
- ((and (= piece ?r)
- (equal (car changes)
- (chess-rf-to-index (if color 7 0) 7)))
- (chess-pos-set-can-castle position (if color ?K ?k) nil))
-
- ((and (= piece ?p)
- (> (abs (- (chess-index-rank (cadr changes))
- (chess-index-rank (car changes)))) 1))
- (chess-pos-set-en-passant position (cadr changes)))))
+ (unless (symbolp (car changes))
+ (let ((piece (downcase (chess-pos-piece position (cadr changes)))))
+ (cond
+ ((and (= piece ?k)
+ (equal (car changes)
+ (chess-rf-to-index (if color 7 0) 4)))
+ (chess-pos-set-can-castle position (if color ?K ?k) nil)
+ (chess-pos-set-can-castle position (if color ?Q ?q) nil))
+
+ ((and (= piece ?r)
+ (equal (car changes)
+ (chess-rf-to-index (if color 7 0) 0)))
+ (chess-pos-set-can-castle position (if color ?Q ?q) nil))
+
+ ((and (= piece ?r)
+ (equal (car changes)
+ (chess-rf-to-index (if color 7 0) 7)))
+ (chess-pos-set-can-castle position (if color ?K ?k) nil))
+
+ ((and (= piece ?p)
+ (> (abs (- (chess-index-rank (cadr changes))
+ (chess-index-rank (car changes)))) 1))
+ (chess-pos-set-en-passant position (cadr changes))))))
;; toggle the side whose move it is
(chess-pos-set-side-to-move position (not color))