[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 0f9f540 125/357: [gnugo int] Maintain tree MNUM.
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 0f9f540 125/357: [gnugo int] Maintain tree MNUM. |
Date: |
Sun, 29 Nov 2020 14:51:04 -0500 (EST) |
branch: externals/gnugo
commit 0f9f5404da7621289382effb6d79e468423fda3b
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Maintain tree MNUM.
* packages/gnugo/gnugo.el (gnugo--tree-mnum): New defsubst.
(gnugo-note): Record new node's move number in the tree MNUM.
(gnugo/sgf-create): Change tree MNUM weakness to ‘key’.
---
gnugo.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index a03cfd6..acd42f4 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -248,6 +248,9 @@ As things stabilize probably more info will be added to
this docstring."
See `gnugo-put'."
(gethash key gnugo-state))
+(defsubst gnugo--tree-mnum (tree)
+ (aref tree 0))
+
(defsubst gnugo--tree-ends (tree)
(aref tree 2))
@@ -959,10 +962,12 @@ are dimmed. The buffer is in View minor mode."
(let* ((pair (cons property value))
(fruit (list pair))
(monkey (gnugo-get :monkey))
- (mem (aref monkey 0)))
+ (mem (aref monkey 0))
+ (tip (car mem)))
(if (memq property '(:B :W))
(let* ((tree (gnugo-get :sgf-gametree))
(ends (gnugo--tree-ends tree))
+ (mnum (gnugo--tree-mnum tree))
(bidx (aref monkey 1)))
;; Detect déjà-vu. That is, when placing "A", avoid:
;;
@@ -1013,11 +1018,12 @@ are dimmed. The buffer is in View minor mode."
;; copy old to the right of new
(push mem (nthcdr bidx ls))
(apply 'vector ls))))
+ (puthash fruit (1+ (gethash tip mnum)) mnum)
(push fruit mem)
(aset ends bidx mem)))
(setf (aref monkey 0) mem)
(incf (aref monkey 2)))
- (setcdr (last (car mem)) fruit))))
+ (setcdr (last tip) fruit))))
(defun gnugo-close-game (end-time resign)
(gnugo-put :game-end-time end-time)
@@ -2543,7 +2549,7 @@ A collection is a list of gametrees, each a vector of
four elements:
(insert file-or-data)
(goto-char (point-min)))
(loop while (morep)
- collect (let* ((mnum (gnugo--mkht))
+ collect (let* ((mnum (gnugo--mkht :weakness 'key))
(kids (gnugo--mkht))
(ends (TREE nil mnum kids))
(root (car (last (car ends)))))
- [elpa] externals/gnugo 53da06f 329/357: [gnugo] Make ‘gnugo-comment’ fall back to root node., (continued)
- [elpa] externals/gnugo 53da06f 329/357: [gnugo] Make ‘gnugo-comment’ fall back to root node., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 781a385 332/357: [gnugo] Drop trailing fullstop for "... done" messages., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c5ef13d 334/357: [gnugo] Make ‘gnugo-goto-pos’ return buffer position., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6170d2a 333/357: [gnugo] Make ‘C-c C-p’ output more spacious., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0320a5c 335/357: [gnugo int] Decruft: Don't bother w/ ‘group’ text property., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8123275 338/357: [gnugo] Drop trailing fullstop in animation message., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 08f11af 339/357: [gnugo int] Incorporate ‘gnugo-toggle-image-display’ into unique caller., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1e01c65 340/357: [gnugo] When sorry, say "Sorry" first., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3541ccf 343/357: [gnugo int] Lift redundant pall of death computation., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 38b2529 124/357: [gnugo int] Add abstraction: gnugo--mkht, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0f9f540 125/357: [gnugo int] Maintain tree MNUM.,
Stefan Monnier <=
- [elpa] externals/gnugo 7211950 346/357: [gnugo] Indicate seki groups on the board., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 35c4645 347/357: [gnugo] Make ‘C-u F’ store additional SGF properties., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 0c4b37b 349/357: [gnugo] Document new ‘C-u F’ behavior., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e66bfa0 352/357: [gnugo int] Gate ‘cursor-intangible-mode’ call precisely, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2f73382 353/357: [gnugo] Add some docstrings to some vars/funcs., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo eb9748f 355/357: [gnugo maint] Update years in copyright notice; nfc., Stefan Monnier, 2020/11/29
- [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