[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 7fee3b2 104/357: [gnugo] Move "1 or 2" calculati
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 7fee3b2 104/357: [gnugo] Move "1 or 2" calculation into ‘gnugo-magic-undo’. |
Date: |
Sun, 29 Nov 2020 14:50:59 -0500 (EST) |
branch: externals/gnugo
commit 7fee3b2ee7110699706bbcc5305da3d4e2a99bb9
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo] Move "1 or 2" calculation into ‘gnugo-magic-undo’.
* packages/gnugo/gnugo.el (gnugo-magic-undo): ...here.
(gnugo-undo-two-moves): Update call to ‘gnugo-magic-undo’.
---
NEWS | 1 +
gnugo.el | 16 ++++++++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS
index 9e52778..47f570b 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ NB: "RCS: X..Y " means that the particular release includes
- performance improvements
- of interest to hackers (see source, BI => backward incompatible)
- ‘:sgf-gametree’ internal representation inverted (BI)
+ - ‘gnugo-magic-undo’ handles SPEC ‘0’
- 2.3.1 | 2014-02-27
- portability fixes
diff --git a/gnugo.el b/gnugo.el
index 4e58013..9cd05fc 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1364,6 +1364,8 @@ check that the position is occupied by a stone of the
user's color,
and if so, remove moves from the history until that position is clear.
If SPEC is a positive number, remove exactly that many moves from the
history, signaling an error if the history is exhausted before finishing.
+If SPEC Is 0 (zero), remove either one or two moves,
+so that you are to play next.
If SPEC is not recognized, signal \"bad spec\" error.
Refresh the board for each move undone. If (in the case where SPEC is
@@ -1377,8 +1379,13 @@ turn to play. Optional second arg NOALT non-nil
inhibits this."
(user-color (gnugo-get :user-color))
(monkey (gnugo-get :monkey))
done ans)
- (cond ((and (numberp spec) (cl-plusp spec))
- (setq n spec done (lambda () (zerop n))))
+ (cond ((numberp spec)
+ (setq n (if (zerop spec)
+ (if (string= user-color (gnugo-get :last-mover))
+ 1
+ 2)
+ spec)
+ done (lambda () (zerop n))))
((string-match "^[a-z]" spec)
(let ((pos (upcase spec)))
(setq done `(lambda ()
@@ -1446,10 +1453,7 @@ However, if you are the last mover, undo only one move.
Regardless, after undoing, it is your turn to play again."
(interactive)
(gnugo-gate)
- (gnugo-magic-undo (if (string= (gnugo-get :user-color)
- (gnugo-get :last-mover))
- 1
- 2)))
+ (gnugo-magic-undo 0))
(defun gnugo-display-final-score ()
"Display final score and other info in another buffer (when game over).
- [elpa] externals/gnugo 5b49aad 316/357: [gnugo int] Use ‘line-end-position’., (continued)
- [elpa] externals/gnugo 5b49aad 316/357: [gnugo int] Use ‘line-end-position’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7544ffe 311/357: [gnugo maint] Add copyright policy to HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1ff7a11 307/357: [gnugo maint] Add ‘URL’ header; trim Hacking URL; drop Tip Jar URL., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 10d29a9 301/357: [gnugo] Only set AP for modified gametrees in the collection., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo da98bc8 288/357: [gnugo int] Replace COND expression w/ IF., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 26c849f 330/357: [gnugo int] Decruft: Don't declare hook and keymap vars., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b5b3fd6 337/357: [gnugo int] Reduce ‘setq’ usage., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c885c9c 020/357: [gnugo int] Avoid variable FORMAT for ‘message’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fce1fb0 077/357: [gnugo sgf] Fix bug: Output subtrees correctly., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5ca7efb 099/357: [gnugo int] Remove redundant game-over condition check., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7fee3b2 104/357: [gnugo] Move "1 or 2" calculation into ‘gnugo-magic-undo’.,
Stefan Monnier <=
- [elpa] externals/gnugo a86327a 108/357: [gnugo] Add command ‘gnugo-frolic-in-the-leaves’ and keybinding., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f5fbba3 153/357: [gnugo int] Fix bug: Update local var ‘ends’ when branching., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a4dcef8 150/357: [gnugo frolic int] Parameterize, centralize awakening., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1b69add 160/357: [gnugo int] Decruft: Drop gametree IR element: KIDS, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 891a97a 177/357: [gnugo int] Add abstraction: gnugo--decorate, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 843cd96 163/357: [gnugo frolic int] Add abstraction: gnugo--sideways, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo eb13b8e 180/357: [gnugo] Dropped command: ‘t’ (gnugo-toggle-dead-group), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6c7e102 181/357: [gnugo int] Rename :waitingp to :waiting; save color there., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 425731b 196/357: [gnugo int] Add abstraction: gnugo--ERR-wait, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3f3af4b 208/357: [gnugo int] Remove from ‘gnugo-state’ instead of setting to nil., Stefan Monnier, 2020/11/29