summaryrefslogtreecommitdiff
path: root/chess-algebraic.el
diff options
context:
space:
mode:
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)