[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 0eede2a 175/357: [gnugo int] Add abstraction: gnu
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 0eede2a 175/357: [gnugo int] Add abstraction: gnugo--count-query |
Date: |
Sun, 29 Nov 2020 14:51:15 -0500 (EST) |
branch: externals/gnugo
commit 0eede2a0550f4928f0594135e5c5cf9d9e2bf322
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Add abstraction: gnugo--count-query
* packages/gnugo/gnugo.el (gnugo--count-query): New defsubst.
(gnugo-estimate-score, gnugo-display-final-score): Use it.
---
gnugo.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index 598767e..b6c9e1b 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -400,6 +400,9 @@ when you are sure the command cannot fail."
(defun gnugo-lsquery (message-format &rest args)
(split-string (apply 'gnugo-query message-format args)))
+(defsubst gnugo--count-query (fmt &rest args)
+ (length (apply 'gnugo-lsquery fmt args)))
+
(defun gnugo--root-node (&optional tree)
(aref (or tree (gnugo-get :sgf-gametree))
2))
@@ -1794,8 +1797,8 @@ captured by each player, and the estimate of who has the
advantage (and
by how many stones)."
(interactive)
(message "Est.score ...")
- (let ((black (length (gnugo-lsquery "list_stones black")))
- (white (length (gnugo-lsquery "list_stones white")))
+ (let ((black (gnugo--count-query "list_stones black"))
+ (white (gnugo--count-query "list_stones white"))
(black-captures (gnugo-query "captures black"))
(white-captures (gnugo-query "captures white"))
(est (gnugo-query "estimate_score")))
@@ -2088,8 +2091,8 @@ Also, add the `:RE' SGF property to the root node of the
game tree."
(terr-q (format "final_status_list %%s_territory %d" seed))
(terr "territory")
(capt "captures")
- (b-terr (length (gnugo-lsquery terr-q "black")))
- (w-terr (length (gnugo-lsquery terr-q "white")))
+ (b-terr (gnugo--count-query terr-q "black"))
+ (w-terr (gnugo--count-query terr-q "white"))
(b-capt (string-to-number (gnugo-get :black-captures)))
(w-capt (string-to-number (gnugo-get :white-captures)))
(komi (gnugo--root-prop :KM)))
- [elpa] externals/gnugo 2dd0aca 357/357: * .gitignore: New file, (continued)
- [elpa] externals/gnugo 2dd0aca 357/357: * .gitignore: New file, Stefan Monnier, 2020/11/29
- [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 <=
- [elpa] externals/gnugo 8a064c5 184/357: [gnugo int] Incorporate *-play-stone into ‘gnugo-push-move’., Stefan Monnier, 2020/11/29
- [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