[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo e019871 206/357: [gnugo] Add abstraction: gnugo-c
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo e019871 206/357: [gnugo] Add abstraction: gnugo-current-player |
Date: |
Sun, 29 Nov 2020 14:51:22 -0500 (EST) |
branch: externals/gnugo
commit e0198717ea5704a3b58240811d9196103222f609
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo] Add abstraction: gnugo-current-player
* packages/gnugo/gnugo.el (gnugo-current-player): New func.
(gnugo-refresh, gnugo-magic-undo, gnugo): Use it.
---
NEWS | 1 +
gnugo.el | 16 +++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 3c51bdf..98ee291 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ NB: "RCS: X..Y " means that the particular release includes
- ‘:sgf-gametree’ internal representation inverted (BI)
- ‘gnugo-magic-undo’ handles SPEC ‘0’
- dropped ‘(gnugo-move-history 'count)’ (BI)
+ - new func: ‘gnugo-current-player’
- 2.3.1 | 2014-02-27
- portability fixes
diff --git a/gnugo.el b/gnugo.el
index 7e7f446..59db6dd 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -332,6 +332,10 @@ Handle the big, slow-to-render, and/or uninteresting ones
specially."
(defun gnugo-other (color)
(if (gnugo--blackp color) "white" "black"))
+(defun gnugo-current-player ()
+ "Return the current player, either \"black\" or \"white\"."
+ (gnugo-other (gnugo-get :last-mover)))
+
(defsubst gnugo--gate-game-over (enable)
(when (and enable (gnugo-get :game-over))
(user-error "Sorry, game over")))
@@ -1545,7 +1549,7 @@ its move."
,(case c
(?b '(or (gnugo-get :black-captures) 0))
(?w '(or (gnugo-get :white-captures) 0))
- (?p '(gnugo-other (gnugo-get :last-mover)))
+ (?p '(gnugo-current-player))
(?t '(let ((ws (gnugo-get :waiting-start)))
(if ws
(cadr (time-since ws))
@@ -1957,7 +1961,7 @@ when play resumes."
(unless (= ?= (aref ans 0))
(user-error "%s" ans))
(pop (aref monkey 0))
- (gnugo-put :last-mover (gnugo-other (gnugo-get :last-mover)))
+ (gnugo-put :last-mover (gnugo-current-player))
(gnugo-merge-showboard-results) ; all
(gnugo-refresh) ; this
(decf n) ; is
@@ -2546,10 +2550,12 @@ starting a new one. See `gnugo-board-mode'
documentation for more info."
(let ((g (gnugo-get :gnugo-color))
(n (or (gnugo--root-prop :HA) 0))
(u (gnugo-get :user-color)))
- (gnugo-put :last-mover g)
- (when (or (and (gnugo--blackp u) (< 1 n))
+ (gnugo-put :last-mover
+ (if (or (and (gnugo--blackp u) (< 1 n))
(and (gnugo--blackp g) (< n 2)))
- (gnugo-put :last-mover u)
+ u
+ g))
+ (when (string= g (gnugo-current-player))
(gnugo-refresh t)
(gnugo-get-move g))))))
- [elpa] externals/gnugo a0ecdea 257/357: [gnugo] Conditionalize xform warping on abdication disable., (continued)
- [elpa] externals/gnugo a0ecdea 257/357: [gnugo] Conditionalize xform warping on abdication disable., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 85e3d91 253/357: [gnugo int] Snoop ‘--handicap N’ for empty new board., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7c7d43c 261/357: [gnugo int] Avoid superfluous ‘gnugo-other’ call., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6ddf38f 269/357: [gnugo int] Add abstraction: gnugo--assist-state, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo d48adca 244/357: [gnugo] On disable, transform in-flight user-move into suggestion., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 764251b 259/357: [gnugo int] Fix bug: Use correct color for "Not your turn yet"., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 16da062 284/357: [gnugo int] Use ‘loop ... collect’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e2f7c7b 212/357: [gnugo int] Consolidate display scaling factors access., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2bde4bc 207/357: [gnugo] Add hook: gnugo-start-game-hook, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 714d3c9 201/357: [gnugo int] Commentary munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e019871 206/357: [gnugo] Add abstraction: gnugo-current-player,
Stefan Monnier <=
- [elpa] externals/gnugo 40f7299 225/357: [gnugo] Fix bug: Ensure gametree sync for -l/--infile., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cedd448 227/357: [gnugo int] Add abstraction: gnugo--prop<-color, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dfe75eb 281/357: [gnugo] Replace ‘gnugo-toggle-image-display-command’ w/ ‘gnugo-image-display-mode’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 88620df 278/357: [gnugo int] Decruft: Drop :local-xpms support., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cacb0c7 275/357: [gnugo] Publicize ‘gnugo-undo-reaction’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 48913fd 313/357: [gnugo maint] Update years in copyright notice; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 844189b 308/357: [gnugo] Release: 3.0.0, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 9928736 299/357: * packages/gnugo: Add `cl-lib' as dependency; require it and use its names., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 67c82c1 309/357: Fix some quoting problems in doc strings, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 6bf46ba 290/357: [gnugo maint] Add ‘Maintainer’ header per top-level README; nfc., Stefan Monnier, 2020/11/29