emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 01/13: [gnugo int] Add abstraction: gnugo--prop<-color


From: Thien-Thi Nguyen
Subject: [elpa] 01/13: [gnugo int] Add abstraction: gnugo--prop<-color
Date: Mon, 21 Apr 2014 21:32:08 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 8bacf43138d31da7354a62a4eb3647749b1235fb
Author: Thien-Thi Nguyen <address@hidden>
Date:   Sun Apr 20 13:09:48 2014 +0200

    [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’.
---
 packages/gnugo/gnugo.el |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 5ce9564..e4774c4 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -344,6 +344,9 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
   "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)))
           (loop
            with ok = (if full



reply via email to

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