[Top][All Lists]

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

[elpa] externals/gnugo a35692a 106/357: [gnugo int] Add abstraction: gnu

From: Stefan Monnier
Subject: [elpa] externals/gnugo a35692a 106/357: [gnugo int] Add abstraction: gnugo--move-prop
Date: Sun, 29 Nov 2020 14:50:59 -0500 (EST)

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

    [gnugo int] Add abstraction: gnugo--move-prop
    * packages/gnugo/gnugo.el (gnugo--move-prop): New defsubst.
    (gnugo-move-history, gnugo-read-sgf-file): Use it.
 gnugo.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 1107f18..b2f9333 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -629,6 +629,10 @@ when you are sure the command cannot fail."
         (when (setq very-strange (get-text-property (1+ cut) 'intangible))
           (put-text-property cut (1+ cut) 'intangible very-strange))))))
+(defsubst gnugo--move-prop (node)
+  (or (assq :B node)
+      (assq :W node)))
 (defun gnugo-move-history (&optional rsel)
   "Determine and return the game's move history.
 Optional arg RSEL controls side effects and return value.
@@ -658,8 +662,7 @@ For all other values of RSEL, do nothing and return nil."
                              (as-pos x)))
          (next (byp) (when (setq node (pop mem)
-                                 mprop (or (assq :B node)
-                                           (assq :W node)))
+                                 mprop (gnugo--move-prop node))
                        (setq move (as-pos-maybe (cdr mprop)))
                        (push (if byp
                                  (format "%s%s" move (car mprop))
@@ -1401,8 +1404,7 @@ If FILENAME already exists, Emacs confirms that you wish 
to overwrite it."
       (gnugo-put :monkey
         (vector mem 0 (loop for node in mem
-                            count (or (assq :B node)
-                                      (assq :W node)))))
+                            count (gnugo--move-prop node))))
       (gnugo-put :game-over
         (setq game-over
               (or (gnugo--root-prop :RE tree)

reply via email to

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