summaryrefslogtreecommitdiff
path: root/chess-ply.el
diff options
context:
space:
mode:
Diffstat (limited to 'chess-ply.el')
-rw-r--r--chess-ply.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/chess-ply.el b/chess-ply.el
index f5261b9..e4f3120 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -72,6 +72,16 @@
;; annotate and extend the ply correctly
(cons (chess-pos-copy position) changes))
+(defun chess-ply-final-p (ply)
+ "Return non-nil if this is the last ply of a game/variation."
+ (let ((changes (chess-ply-changes ply)))
+ (or (memq ':draw changes)
+ (memq ':perpetual changes)
+ (memq ':repetition changes)
+ (memq ':stalemate changes)
+ (memq ':resign changes)
+ (memq ':checkmate changes))))
+
(defun chess-legal-plies (position &optional search-func)
"Return a list of all legal plies in POSITION."
(let (plies)