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

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

[elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnu


From: Stefan Monnier
Subject: [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over
Date: Sun, 29 Nov 2020 14:51:20 -0500 (EST)

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

    [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.
---
 gnugo.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 76544d1..77d6946 100644
--- a/gnugo.el
+++ b/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]