[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 6ee477d 112/357: [gnugo int] Remove abstraction:
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 6ee477d 112/357: [gnugo int] Remove abstraction: continue-on |
Date: |
Sun, 29 Nov 2020 14:51:01 -0500 (EST) |
branch: externals/gnugo
commit 6ee477d7b91f8682a10e5389457cf2d192c71650
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Remove abstraction: continue-on
* packages/gnugo/gnugo.el (gnugo-note): ...here, inlining it.
---
gnugo.el | 89 ++++++++++++++++++++++++++++++----------------------------------
1 file changed, 42 insertions(+), 47 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index ca8042a..c271f8e 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -953,53 +953,48 @@ are dimmed. The buffer is in View minor mode."
;; X---Y---A new
;; \
;; --B old
- (cl-flet
- ((continue-on (bx)
- (rotatef (aref tree bidx)
- (aref tree bx))))
- (loop
- with count = (length tree)
- with (bx previous)
- for i
- ;; Start with latest / highest likelihood for hit.
- ;; todo: prune unfeasible candidates
- from (if (gnugo--no-regrets monkey tree)
- 1
- 0)
- below count
- if (setq bx (mod (+ bidx i) count)
- previous
- ;; todo: early termination based on move number
- (loop for m on (aref tree bx)
- if (eq mem (cdr m))
- return
- (when (equal pair (assoc property (car m)))
- m)
- finally return
- nil))
- ;; yes => follow
- return
- (progn
- ;; (message "déjà-vu! %d follows %d" bidx bx)
- (unless (= bidx bx)
- (continue-on bx))
- (setq mem previous))
- ;; no => construct
- finally do
- (progn
- ;; (message "new %d" bidx)
- (unless (gnugo--no-regrets monkey tree)
- ;; <grumble grumble> SGF sez "move" node in the root
- ;; position of a (sub-)gametree is "bad style". :-/
- (let ((where (memq tree (gnugo-get :sgf-collection))))
- (setq tree (let ((ls (append tree nil)))
- ;; copy old to the right of new
- (push mem (nthcdr bidx ls))
- (apply 'vector ls)))
- (gnugo-put :sgf-gametree tree)
- (setcar where tree)))
- (push fruit mem)
- (aset tree bidx mem))))
+ (loop
+ with count = (length tree)
+ with (bx previous)
+ for i
+ ;; Start with latest / highest likelihood for hit.
+ ;; todo: prune unfeasible candidates
+ from (if (gnugo--no-regrets monkey tree)
+ 1
+ 0)
+ below count
+ if (setq bx (mod (+ bidx i) count)
+ previous
+ ;; todo: early termination based on move number
+ (loop for m on (aref tree bx)
+ if (eq mem (cdr m))
+ return
+ (when (equal pair (assoc property (car m)))
+ m)
+ finally return
+ nil))
+ ;; yes => follow
+ return
+ (progn
+ (unless (= bidx bx)
+ (rotatef (aref tree bidx)
+ (aref tree bx)))
+ (setq mem previous))
+ ;; no => construct
+ finally do
+ (progn
+ (unless (gnugo--no-regrets monkey tree)
+ ;; <grumble grumble> SGF sez "move" node in the root
+ ;; position of a (sub-)gametree is "bad style". :-/
+ (let ((where (memq tree (gnugo-get :sgf-collection))))
+ (setq tree (let ((ls (append tree nil)))
+ ;; copy old to the right of new
+ (push mem (nthcdr bidx ls))
+ (apply 'vector ls)))
+ (gnugo-put :sgf-gametree tree)
+ (setcar where tree)))
+ (push fruit mem)
+ (aset tree bidx mem)))
(setf (aref monkey 0) mem)
(incf (aref monkey 2)))
(setcdr (last (car mem)) fruit))))
- [elpa] externals/gnugo 0c7bc82 025/357: [gnugo int] Use cl-{plus, minus}p more., (continued)
- [elpa] externals/gnugo 0c7bc82 025/357: [gnugo int] Use cl-{plus, minus}p more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6d835b3 023/357: [gnugo int] Drop unused local var., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2a75447 034/357: [gnugo int] Use ‘set-process-query-on-exit-flag’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bd4d40f 028/357: [gnugo int] Drop leading "*" in docstrings., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7ef5c66 036/357: [gnugo int] Revamp gnugo-{put, get} doc / indentation decl., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo d41a581 029/357: [gnugo] Indicate buffer not modified after load., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 80a22a5 032/357: [gnugo] Use ‘user-error’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 423683d 055/357: [gnugo int] Use ‘dolist’, ‘destructuring-bind’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7c3a30f 100/357: [gnugo int] Use ‘pop’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a35692a 106/357: [gnugo int] Add abstraction: gnugo--move-prop, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6ee477d 112/357: [gnugo int] Remove abstraction: continue-on,
Stefan Monnier <=
- [elpa] externals/gnugo 58d4d6d 117/357: [gnugo int] Add abstractions: gnugo--{, set-}tree-ends, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f107328 122/357: [gnugo int] Expand gametree IR: MNUM, KIDS, ROOT., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c3b3c3f 123/357: [gnugo int] Fix bug: Detect case for KIDS addition correctly., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a63d31b 128/357: [gnugo int] Comment munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3a7f75e 132/357: [gnugo] Define "GNUGO Frolic" mode., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cb78651 138/357: [gnugo frolic] Add command to prune a branch., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7025924 156/357: [gnugo sgf] Fix bug: Add ‘\’-escapes on write., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e64f1ae 170/357: [gnugo frolic] Add previous/next move navigation commands., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c78119f 191/357: [gnugo int] Add abstraction: gnugo--finish-move, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a3d90aa 189/357: [gnugo maint] Update HACKING; nfc., Stefan Monnier, 2020/11/29