[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 8a064c5 184/357: [gnugo int] Incorporate *-play-
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 8a064c5 184/357: [gnugo int] Incorporate *-play-stone into ‘gnugo-push-move’. |
Date: |
Sun, 29 Nov 2020 14:51:17 -0500 (EST) |
branch: externals/gnugo
commit 8a064c5ec04ca6be9addd5dbf6b2672114a221e3
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Incorporate *-play-stone into ‘gnugo-push-move’.
U (X) ≡ "Don't call X".
* packages/gnugo/gnugo.el (gnugo--play-stone): Delete func.
(gnugo--user-play-stone): Delete defsubst.
(gnugo-push-move): Do GTP "play COLOR MOVE" here.
(gnugo-get-move-insertion-filter): U (gnugo--play-stone);
make USERP arg to ‘gnugo-push-move’ depend on :waiting color.
(gnugo-move, gnugo-pass): U (gnugo--user-play-stone).
(gnugo-okay): U (gnugo--play-stone); decruft local vars.
(gnugo-display-final-score): U (gnugo--play-stone).
---
gnugo.el | 29 ++++++++---------------------
1 file changed, 8 insertions(+), 21 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 09c2c76..bd1437a 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -419,14 +419,6 @@ when you are sure the command cannot fail."
(push (cons prop value)
(cdr (last root))))))
-(defun gnugo--play-stone (color pos-or-PASS)
- (let ((accept (gnugo--q (format "play %s %s" color pos-or-PASS))))
- (unless (= ?= (aref accept 0))
- (user-error "%s" accept))))
-
-(defsubst gnugo--user-play-stone (pos-or-PASS)
- (gnugo--play-stone (gnugo-get :user-color) pos-or-PASS))
-
(defun gnugo-goto-pos (pos)
"Move point to board position POS, a letter-number string."
(goto-char (point-min))
@@ -1239,6 +1231,10 @@ This fails if the monkey is on the current branch
(head (gnugo-move-history 'car))
(onep (and head (gnugo--passp head)))
(donep (or resignp (and onep passp))))
+ (unless resignp
+ (let ((accept (gnugo--q (format "play %s %s" color move))))
+ (unless (= ?= (aref accept 0))
+ (user-error "%s" accept))))
(unless passp
(gnugo-merge-showboard-results))
(gnugo-put :last-mover color)
@@ -1559,8 +1555,8 @@ its move."
(color (gnugo-get :waiting)))
(gnugo-put :get-move-string nil)
(gnugo-put :waiting nil)
- (gnugo--play-stone color pos-or-pass)
- (gnugo-push-move nil pos-or-pass)
+ (gnugo-push-move (string= color (gnugo-get :user-color))
+ pos-or-pass)
(let ((buf (current-buffer)))
(let (gnugo-inhibit-refresh)
(run-hooks 'gnugo-post-move-hook)
@@ -1610,7 +1606,6 @@ To start a game try M-x gnugo."
(gnugo-gate t)
(let* ((buf (current-buffer))
(pos (gnugo-position)))
- (gnugo--user-play-stone pos)
(gnugo-push-move t pos) ; value always nil for non-pass move
(let (gnugo-inhibit-refresh)
(run-hooks 'gnugo-post-move-hook)
@@ -1633,7 +1628,6 @@ Signal error if done out-of-turn or if game-over.
To start a game try M-x gnugo."
(interactive)
(gnugo-gate t)
- (gnugo--user-play-stone "PASS")
(let ((donep (gnugo-push-move t "PASS"))
(buf (current-buffer)))
(let (gnugo-inhibit-refresh)
@@ -1965,7 +1959,6 @@ Prefix arg means to redo all the undone moves."
(bidx (aref monkey 1))
(end (aref ends bidx))
(ucolor (gnugo-get :user-color))
- (gcolor (gnugo-other ucolor))
(uprop (if (gnugo--blackp ucolor)
:B :W)))
(cl-flet ((mvno (node) (gethash node mnum)))
@@ -1980,16 +1973,14 @@ Prefix arg means to redo all the undone moves."
move (gnugo--move-prop node))
(when (and move (>= ok (mvno node)))
(let ((userp (eq uprop (car move))))
- (push (list (if userp ucolor gcolor)
- userp
+ (push (list userp
(funcall as-pos (cdr move)))
todo))))
until (eq mem (cdr ls))
finally do
(loop
- for (color userp pos) in todo
+ for (userp pos) in todo
do (progn
- (gnugo--play-stone color pos)
(gnugo-push-move userp pos)
(gnugo-refresh)
(redisplay)))))))))
@@ -2011,10 +2002,6 @@ Also, add the `:RE' SGF property to the root node of the
game tree."
(message "Playing PASS for %s ..."
(gnugo-get (if userp :user-color :gnugo-color)))
(sit-for 1)
- (gnugo--play-stone (gnugo-get (if userp
- :user-color
- :gnugo-color))
- "PASS")
(gnugo-push-move userp "PASS")))
(unless (pass t)
(pass nil)))
- [elpa] externals/gnugo ee905ef 048/357: [gnugo] Fix bug: Compute grid spacing using offset math., (continued)
- [elpa] externals/gnugo ee905ef 048/357: [gnugo] Fix bug: Compute grid spacing using offset math., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 566623c 121/357: [gnugo int] Invert ‘if’ CONDITION and THEN/ELSE clauses., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 19309c3 139/357: [gnugo frolic] Handle invalid branch more consistently., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo d214e7e 137/357: [gnugo frolic] Add command to set the main line., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dd42857 148/357: [gnugo frolic] Set ‘truncate-lines’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1a544a5 154/357: [gnugo int] Whitespace munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 89d10e4 159/357: [gnugo int] Reorder gametree IR: ENDS, MNUM, ROOT, KIDS., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bba08d3 158/357: [gnugo sgf int] Internalize ‘gnugo/sgf-hang-from-root’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2f09438 145/357: [gnugo int] Fix syntax error., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0eede2a 175/357: [gnugo int] Add abstraction: gnugo--count-query, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8a064c5 184/357: [gnugo int] Incorporate *-play-stone into ‘gnugo-push-move’.,
Stefan Monnier <=
- [elpa] externals/gnugo ee09531 192/357: [gnugo] New command: ‘S’ (gnugo-request-suggestion), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bc92d6d 202/357: [gnugo frolic] Type ‘Q’ to quit., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a3baa99 200/357: [gnugo int] Use ‘following-char’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e644695 203/357: [gnugo] Increase S/N for ‘C-u F’ comment., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7b29f73 219/357: [gnugo int] Decruft: Don't stash :proc-args., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 12d3d80 216/357: [gnugo] Keep GNUGO Board buffer read-only., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 4b6e204 221/357: [gnugo int] Move some prop jamming to ‘gnugo-board-mode’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo d52bbc7 222/357: [gnugo int] Add abstraction: gnugo--nquery, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e837853 226/357: [gnugo int] Declare ‘lexical-binding: t’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bc4abdc 238/357: [gnugo int] Centralize some "No stone at POS" errors., Stefan Monnier, 2020/11/29