[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnugo 622b1eb 084/357: [gnugo] Handle ‘(gnugo-move-his

From: Stefan Monnier
Subject: [elpa] externals/gnugo 622b1eb 084/357: [gnugo] Handle ‘(gnugo-move-history 'two)’.
Date: Sun, 29 Nov 2020 14:50:54 -0500 (EST)

branch: externals/gnugo
commit 622b1eb355832d137c82edc90eabe10fa3c77e85
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [gnugo] Handle ‘(gnugo-move-history 'two)’.
    * packages/gnugo/gnugo.el (gnugo-move-history):
    If RSEL is ‘two’, return the last two moves as a list.
    (gnugo-read-sgf-file): Use ‘gnugo-move-history’.
 NEWS     |  1 +
 gnugo.el | 12 +++---------
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 7ca102b..799cb56 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Hint: (highlight-phrase 
     - handle subtrees on write
   - new keybinding for ‘gnugo-undo-one-move’: M-u
   - ‘gnugo-undo-one-move’ can optionally switch colors
+  - ‘gnugo-move-history’ returns last two moves w/ RSEL ‘two’
   - performance improvements
 - 2.3.1 | 2014-02-27
diff --git a/gnugo.el b/gnugo.el
index 65d5e32..dda41b2 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -633,7 +633,7 @@ interactively with a prefix arg (i.e., RSEL is `(4)'), 
 similarly, but suffix with the mover (either \":B\" or \":W\").
 If RSEL is the symbol `car' return the most-recent move; if
 `cadr', the next-to-most-recent move; if `count' the number of
-moves thus far.
+moves thus far; if `two' the last two moves as a list, oldest last.
 For all other values of RSEL, do nothing and return nil."
   (interactive "P")
@@ -670,6 +670,7 @@ For all other values of RSEL, do nothing and return nil."
         (`car        (car (nn)))
         (`cadr  (nn) (car (nn)))
         (`count (aref monkey 2))
+        (`two (nn) (nn) acc)
         (_ nil)))))
 (defun gnugo-boss-is-near ()
@@ -1343,14 +1344,7 @@ If FILENAME already exists, Emacs confirms that you wish 
to overwrite it."
         (setq game-over
               (or (cdr (assq :RE (car tree)))
                   (and (cdr mem)
-                       (equal '("tt" "tt")
-                              (let ((order (if (string= "black" wait)
-                                               '(:B :W)
-                                             '(:W :B))))
-                                (mapcar (lambda (pk)
-                                          (cdr (assq (funcall pk order)
-                                                     (car (funcall pk mem)))))
-                                        '(car cadr))))
+                       (equal '("PASS" "PASS") (gnugo-move-history 'two))
       (gnugo-put :monkey
         (vector (or (car mem) tree)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]