summaryrefslogtreecommitdiff
path: root/chess-algebraic.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-04 21:38:32 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-04 21:38:32 +0000
commit67a7fe26822966cb39a83fb8f822a3a77680f847 (patch)
tree83493f46a40e34158e3394f1f276a7ded5693f6a /chess-algebraic.el
parentaf77479cf17f24ed1fbb39743af2d180ca64df60 (diff)
fixed conversion of pawn captures
Diffstat (limited to 'chess-algebraic.el')
-rw-r--r--chess-algebraic.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/chess-algebraic.el b/chess-algebraic.el
index de2d953..cd67c6a 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -70,6 +70,9 @@ This regexp handles both long and short form.")
(target (chess-coord-to-index (match-string 7 move))))
(if (and source (= (length source) 2))
(list (chess-coord-to-index source) target)
+ (if (= (length source) 0)
+ (setq source nil)
+ (setq source (aref source 0)))
(let (candidates which)
(unless (< piece ?a)
(setq piece ?P))
@@ -87,8 +90,10 @@ This regexp handles both long and short form.")
(error "Clarify piece to move by rank or file")
(while candidates
(if (if (>= source ?a)
- (eq (cdar candidates) (- source ?a))
- (eq (caar candidates) (- 7 (- source ?1))))
+ (eq (chess-index-file (car candidates))
+ (- source ?a))
+ (eq (chess-index-rank (car candidates))
+ (- 7 (- source ?1))))
(setq which (car candidates) candidates nil)
(setq candidates (cdr candidates))))
(if (null which)