diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-10 23:55:13 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-10 23:55:13 +0000 |
| commit | a0769011c2a98841156559aa37978156766cc09f (patch) | |
| tree | 407832c3c0fac049e9e7d567614894cc47e76f3c /chess-game.el | |
| parent | 5fbbfaf36f1dc7da3c7539568fe473bbf079c513 (diff) | |
Added support for aborting a game. Use A or N from a display.
Diffstat (limited to 'chess-game.el')
| -rw-r--r-- | chess-game.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/chess-game.el b/chess-game.el index 995e741..35e41ce 100644 --- a/chess-game.el +++ b/chess-game.el @@ -101,11 +101,14 @@ matches." (nth 2 game)) (defun chess-game-set-data (game key value) - (let ((alist (chess-game-data-alist game))) - (if (null alist) - (setcar (nthcdr 2 game) (list (cons key value))) - (push (cons key value) alist) - (setcar (nthcdr 2 game) alist)) + (let* ((alist (chess-game-data-alist game)) + (cell (assq key alist))) + (if cell + (setcdr cell value) + (if (null alist) + (setcar (nthcdr 2 game) (list (cons key value))) + (push (cons key value) alist) + (setcar (nthcdr 2 game) alist))) (chess-game-run-hooks game 'set-data key))) (defun chess-game-data (game key) @@ -163,6 +166,12 @@ matches." (chess-game-set-plies game (list ply))))) +(defsubst chess-game-over-p (game) + "Return the position related to GAME's INDEX position." + (let ((last-ply (car (last game 2)))) + (and last-ply (chess-ply-final-p last-ply)))) + + (defsubst chess-game-to-string (game &optional indented) (chess-game-to-pgn game indented t)) |
