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

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

[elpa] 03/06: [gnugo int] Add abstraction: gnugo--gate-game-over


From: Thien-Thi Nguyen
Subject: [elpa] 03/06: [gnugo int] Add abstraction: gnugo--gate-game-over
Date: Tue, 15 Apr 2014 19:19:48 +0000

ttn pushed a commit to branch master
in repository elpa.

commit f79f5475414dded637f87ae10dd5790b44334eed
Author: Thien-Thi Nguyen <address@hidden>
Date:   Tue Apr 15 20:26:15 2014 +0200

    [gnugo int] Add abstraction: gnugo--gate-game-over
    
    * packages/gnugo/gnugo.el (gnugo--gate-game-over): New defsubst.
    (gnugo-gate, gnugo-toggle-abdication): Use it.
---
 packages/gnugo/gnugo.el |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 76544d1..77d6946 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -329,6 +329,10 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
 (defun gnugo-other (color)
   (if (gnugo--blackp color) "white" "black"))
 
+(defsubst gnugo--gate-game-over (enable)
+  (when (and enable (gnugo-get :game-over))
+    (user-error "Sorry, game over")))
+
 (defun gnugo--ERR-wait (color why)
   (user-error "%s -- please wait for \"(%s to play)\""
               why color))
@@ -344,8 +348,7 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
                        (if (cdr slow)
                            "Still thinking"
                          "Not your turn yet"))))
-  (when (and in-progress-p (gnugo-get :game-over))
-    (user-error "Sorry, game over")))
+  (gnugo--gate-game-over in-progress-p))
 
 (defun gnugo-sentinel (proc string)
   (let ((status (process-status proc)))
@@ -2280,8 +2283,7 @@ This is to ensure that the user is the next to play after 
disabling."
           (unless color
             (gnugo-get-move gcolor)))
       ;; enable
-      (when (gnugo-get :game-over)
-        (user-error "Sorry, game over"))
+      (gnugo--gate-game-over t)
       (gnugo-put :abd t)
       (gnugo-get-move (gnugo-other last-mover)))
     (message "Abdication %sabled%s"



reply via email to

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