diff options
| author | Mario Lang <mlang@delysid.org> | 2004-01-09 07:37:10 +0000 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2004-01-09 07:37:10 +0000 |
| commit | a0a3564fd2f3d80edfe0932bc85a5517d14685fb (patch) | |
| tree | 9b55ed12579a7bb062b806eed40c1d9dc9585c8e | |
| parent | 019479317390a484dd52f0fd145c878b2c180310 (diff) | |
New function chess-var-to-algebraic
| -rw-r--r-- | chess-var.el | 16 | ||||
| -rw-r--r-- | chess.texi | 6 |
2 files changed, 17 insertions, 5 deletions
diff --git a/chess-var.el b/chess-var.el index 0ef94d4..ed918ad 100644 --- a/chess-var.el +++ b/chess-var.el @@ -11,12 +11,12 @@ (require 'chess-ply) (defsubst chess-var-plies (var) - "Return the tags alist associated with VAR." + "Return the plies of VAR." (assert var) var) (defsubst chess-var-pos (var &optional index) - "Return the position related to VAR's INDEX position." + "Return the position related to VAR's INDEX ply." (assert var) (chess-ply-pos (chess-var-ply var index))) @@ -37,7 +37,7 @@ of the variation if INDEX is nil)." (chess-pos-side-to-move (chess-var-pos var index))) (defun chess-var-ply (var &optional index) - "Return the position related to VAR's INDEX position." + "Return VAR's INDEXth ply." (assert var) (if index (nth index (chess-var-plies var)) @@ -76,6 +76,16 @@ progress (nil), if it is drawn, resigned, mate, etc." (chess-var-add-ply var (chess-ply-create* (chess-ply-next-pos current-ply))))) +(defun chess-var-to-algebraic (var &optional long) + "Reveal the plies of VAR by converting them to algebraic +notation." + (mapconcat (lambda (ply) + (chess-ply-to-algebraic ply long)) + (if (chess-ply-final-p (chess-var-ply var)) + (chess-var-plies var) + (reverse (cdr (reverse (chess-var-plies var))))) + " ")) + (provide 'chess-var) ;;; chess-var.el ends here @@ -279,14 +279,16 @@ turn, as mentioned above. @c lispfun chess-var-ply +@c lispfun chess-var-plies + +@c lispfun chess-var-to-algebraic + @subsection Making a move in a variation @c lispfun chess-var-move @c lispfun chess-var-add-ply -@c lispfun chess-var-plies - @section Games A @dfn{game} includes its main variation, incidental information about |
