From 899d559886410a9dca43ae793496c6384e381b43 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 11 Apr 2002 01:36:27 +0000 Subject: *** no comment *** --- chess-pos.el | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'chess-pos.el') 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)) -- cgit v1.2.3