diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-12 10:59:33 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-12 10:59:33 +0000 |
| commit | c6d397dde9c2c5dd2d1be993ffe3117bc25e6fb8 (patch) | |
| tree | 83c1ea17fdce15588c96147c6df7495e3bd875b6 /chess-algebraic.el | |
| parent | de037adf033425192efefb66f098037766c6932e (diff) | |
*** no comment ***
Diffstat (limited to 'chess-algebraic.el')
| -rw-r--r-- | chess-algebraic.el | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/chess-algebraic.el b/chess-algebraic.el index ed6f020..a1bc1e6 100644 --- a/chess-algebraic.el +++ b/chess-algebraic.el @@ -82,25 +82,28 @@ This regexp handles both long and short form.") ;; we must use our knowledge of how pieces can ;; move, to determine which piece is meant by the ;; piece indicator - (when (setq candidates - (chess-search-position position target - (if color piece - (downcase piece)))) - (if (= (length candidates) 1) - (list (car candidates) target) - (if (null source) - (error "Clarify piece to move by rank or file") - (while candidates - (if (if (>= source ?a) - (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) - (error "Could not determine which piece to use") - (list which target))))))))) + (if (setq candidates + (chess-search-position position target + (if color piece + (downcase piece)))) + (if (= (length candidates) 1) + (list (car candidates) target) + (if (null source) + (error "Clarify piece to move by rank or file") + (while candidates + (if (if (>= source ?a) + (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) + (error "Could not determine which piece to use") + (list which target)))) + (error "There are no candidate moves for '%s'" + move)))))) (if promotion (nconc changes (list :promote (aref promotion 0)))))) @@ -155,7 +158,7 @@ If LONG is non-nil, render the move into long notation." (if (/= ? (chess-pos-piece pos to)) "x" (if long "-")) (chess-index-to-coord to) - (let ((promote (chess-ply-has-keyword ply :promote))) + (let ((promote (memq :promote (chess-ply-changes ply)))) (if promote (concat "=" (char-to-string (upcase (cadr promote)))))) |
