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

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

[elpa] externals/gnugo f102d7f 240/357: [gnugo] Allow user to move for G


From: Stefan Monnier
Subject: [elpa] externals/gnugo f102d7f 240/357: [gnugo] Allow user to move for GNU Go.
Date: Sun, 29 Nov 2020 14:51:30 -0500 (EST)

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

    [gnugo] Allow user to move for GNU Go.
    
    * packages/gnugo/gnugo.el (gnugo--user-play):
    Don't hardcode WHO to ‘gnugo-push-move’;
    instead, compute it from :last-mover.
---
 NEWS     |  1 +
 gnugo.el | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index a11e43e..6898cf0 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ NB: "RCS: X..Y " means that the particular release includes
   - ‘=’ also displays move number of the stone (if any) at that position
   - ‘C-u F’ adds the (abbreviated) blurb as a comment to the last node
   - new keybinding for ‘gnugo-undo-one-move’: M-u
+  - you can play a move for GNU Go, e.g., after ‘M-u’
   - ‘gnugo-undo-one-move’ can optionally arrange for you to play next
   - new command: ‘S’ (gnugo-request-suggestion)
   - new command: ‘C’ (gnugo-comment)
diff --git a/gnugo.el b/gnugo.el
index 345fd9b..ae962fc 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1707,12 +1707,17 @@ cursor to the suggested position.  Prefix arg inhibits 
warp."
 
 (defun gnugo--user-play (pos-or-pass)
   (gnugo-gate t)
-  (let ((donep (gnugo-push-move t pos-or-pass))
-        (buf (current-buffer)))
+  ;; The "user" in this func's name used to signify both
+  ;; who does the action and for whom the action is done.
+  ;; Now, it signifies only the former.
+  (let* ((gcolor (gnugo-get :gnugo-color))
+         (userp (string= gcolor (gnugo-get :last-mover)))
+         (donep (gnugo-push-move userp pos-or-pass))
+         (buf (current-buffer)))
     (gnugo--finish-move buf)
-    (unless donep
+    (when (and userp (not donep))
       (with-current-buffer buf
-        (gnugo-get-move (gnugo-get :gnugo-color))))))
+        (gnugo-get-move gcolor)))))
 
 (defun gnugo-move ()
   "Make a move on the GNUGO Board buffer.



reply via email to

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