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

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

[elpa] 01/08: [gnugo] Allow user to move for GNU Go.


From: Thien-Thi Nguyen
Subject: [elpa] 01/08: [gnugo] Allow user to move for GNU Go.
Date: Wed, 23 Apr 2014 09:00:22 +0000

ttn pushed a commit to branch master
in repository elpa.

commit ebfc94428eb3bf97c00f317389c6da916f0958a5
Author: Thien-Thi Nguyen <address@hidden>
Date:   Tue Apr 22 11:39:07 2014 +0200

    [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.
---
 packages/gnugo/NEWS     |    1 +
 packages/gnugo/gnugo.el |   13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS
index a11e43e..6898cf0 100644
--- a/packages/gnugo/NEWS
+++ b/packages/gnugo/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/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 345fd9b..ae962fc 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/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]