summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-08 05:47:20 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-08 05:47:20 +0000
commit54d66578bec3e22b42a5bc33198119968120fd35 (patch)
tree57a7544705451271c43570486a67be9afff6f8ea
parent55992a578859ee70b025df5d3f2cbd4ec6f94d4c (diff)
added castling keywords
-rw-r--r--chess-algebraic.el8
-rw-r--r--chess-ply.el6
2 files changed, 6 insertions, 8 deletions
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 09f8b30..737a4d0 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -116,12 +116,8 @@ If LONG is non-nil, render the move into long notation."
(color (chess-pos-side-to-move pos)) str
(notation
(if (setq str
- (and (= (upcase from-piece) ?K)
- (= from (chess-rf-to-index (if color 7 0) 4))
- (if (= to (chess-rf-to-index (if color 7 0) 6))
- "O-O"
- (if (= to (chess-rf-to-index (if color 7 0) 2))
- "O-O-O"))))
+ (if (memq :castle changes) "O-O"
+ (if (memq :long-castle changes) "O-O-O")))
str
(let ((candidates (chess-search-position pos to from-piece))
(rank 0) (file 0)
diff --git a/chess-ply.el b/chess-ply.el
index 01208ea..335519d 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -100,9 +100,11 @@ maneuver."
;; if so, add the rook moves
(nconc changes (if kingside
(list (chess-rf-to-index (if color 7 0) 7)
- (chess-rf-to-index (if color 7 0) 5))
+ (chess-rf-to-index (if color 7 0) 5)
+ :castle)
(list (chess-rf-to-index (if color 7 0) 0)
- (chess-rf-to-index (if color 7 0) 3)))))))
+ (chess-rf-to-index (if color 7 0) 3)
+ :long-castle))))))
(let* ((next-pos (chess-ply-next-pos ply))
(color (chess-pos-side-to-move next-pos)))