summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chess-var.el16
-rw-r--r--chess.texi6
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
diff --git a/chess.texi b/chess.texi
index 89cd356..5158905 100644
--- a/chess.texi
+++ b/chess.texi
@@ -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