diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-03-11 20:57:21 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-03-11 20:57:21 +0000 |
| commit | 871e9bb270b35c621265fc56ec582bdd39900e2a (patch) | |
| tree | 0f031b50dba5beb8a49e697f2488831a32f69655 /chess-algebraic.el | |
| parent | 442c62fd96d5cb79ab34faf1d8108d86372e96c3 (diff) | |
changes
Diffstat (limited to 'chess-algebraic.el')
| -rw-r--r-- | chess-algebraic.el | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/chess-algebraic.el b/chess-algebraic.el index 0b041cb..d32bbbb 100644 --- a/chess-algebraic.el +++ b/chess-algebraic.el @@ -33,7 +33,6 @@ ;; $Revision$ -(require 'chess-pos) (require 'chess-ply) (defconst chess-algebraic-pieces-regexp "[RNBKQ]") @@ -52,7 +51,7 @@ "A regular expression that matches all possible algebraic moves. This regexp handles both long and short form.") -(defun chess-algebraic-to-ply (position move) +(defun chess-algebraic-to-ply (position move &optional search-func) "Convert the algebraic notation MOVE for POSITION to a ply." (when (string-match chess-algebraic-regexp move) (let* ((color (chess-pos-side-to-move position)) @@ -77,10 +76,9 @@ This regexp handles both long and short form.") ;; move, to determine which piece is meant by the ;; piece indicator (when (setq candidates - (funcall (car chess-modules) nil nil - 'search position target - (if color piece - (downcase piece)))) + (funcall (or search-func chess-standard-search) + position target (if color piece + (downcase piece)))) (if (= (length candidates) 1) (list (car candidates) target) (if (null source) @@ -101,7 +99,7 @@ This regexp handles both long and short form.") ':check)))) (apply 'chess-ply-create position changes)))) -(defun chess-ply-to-algebraic (ply &optional long) +(defun chess-ply-to-algebraic (ply &optional long search-func) "Convert the given PLY to algebraic notation. If LONG is non-nil, render the move into long notation." (if (null (car (chess-ply-changes ply))) @@ -122,8 +120,8 @@ If LONG is non-nil, render the move into long notation." "O-O-O")))) str (let ((candidates - (funcall (car chess-modules) - nil nil 'search pos to from-piece)) + (funcall (or search-func chess-standard-search) + pos to from-piece)) (rank 0) (file 0) (from-rank (/ from 8)) (from-file (mod from 8)) |
