[Top][All Lists]

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

[elpa] externals/gnugo cedd448 227/357: [gnugo int] Add abstraction: gnu

From: Stefan Monnier
Subject: [elpa] externals/gnugo cedd448 227/357: [gnugo int] Add abstraction: gnugo--prop<-color
Date: Sun, 29 Nov 2020 14:51:27 -0500 (EST)

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

    [gnugo int] Add abstraction: gnugo--prop<-color
    * packages/gnugo/gnugo.el (gnugo--prop<-color): New defsubst.
    (gnugo-push-move, gnugo-okay): Use ‘gnugo--prop<-color’.
 gnugo.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 5ce9564..e4774c4 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -344,6 +344,9 @@ Handle the big, slow-to-render, and/or uninteresting ones 
   "Return the current player, either \"black\" or \"white\"."
   (gnugo-other (gnugo-get :last-mover)))
+(defsubst gnugo--prop<-color (color)
+  (if (gnugo--blackp color) :B :W))
 (defsubst gnugo--gate-game-over (enable)
   (when (and enable (gnugo-get :game-over))
     (user-error "Sorry, game over")))
@@ -1282,8 +1285,7 @@ This fails if the monkey is on the current branch
             (string= ucolor color))
       (gnugo-put :last-user-bpos (and (not passp) (not resignp) move)))
     ;; update :sgf-gametree and :monkey
-    (let* ((property (if (gnugo--blackp color)
-                         :B :W))
+    (let* ((property (gnugo--prop<-color color))
            (pair (cons property (cond (resignp move)
                                       (passp "")
                                       (t (funcall (gnugo--as-cc-func)
@@ -2047,8 +2049,7 @@ Prefix arg means to redo all the undone moves."
              (bidx (aref monkey 1))
              (end (aref ends bidx))
              (ucolor (gnugo-get :user-color))
-             (uprop (if (gnugo--blackp ucolor)
-                        :B :W)))
+             (uprop (gnugo--prop<-color ucolor)))
         (cl-flet ((mvno (node) (gethash node mnum)))
            with ok = (if full

reply via email to

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