[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnu
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnugo--user-play |
Date: |
Sun, 29 Nov 2020 14:51:21 -0500 (EST) |
branch: externals/gnugo
commit 32e854733c732922a86c385255d1c399c82ce31e
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo int] Add abstraction: gnugo--user-play
* packages/gnugo/gnugo.el (gnugo--user-play): New func.
(gnugo-move, gnugo-pass): Use ‘gnugo--user-play’.
---
gnugo.el | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/gnugo.el b/gnugo.el
index b58ff35..f3952a6 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1667,19 +1667,22 @@ cursor to the suggested position. Prefix arg inhibits
warp."
'nowarp
t)))
+(defun gnugo--user-play (pos-or-pass)
+ (gnugo-gate t)
+ (let ((donep (gnugo-push-move t pos-or-pass))
+ (buf (current-buffer)))
+ (gnugo--finish-move buf)
+ (unless donep
+ (with-current-buffer buf
+ (gnugo-get-move (gnugo-get :gnugo-color))))))
+
(defun gnugo-move ()
"Make a move on the GNUGO Board buffer.
The position is computed from current point.
Signal error if done out-of-turn or if game-over.
To start a game try M-x gnugo."
(interactive)
- (gnugo-gate t)
- (let* ((buf (current-buffer))
- (pos (gnugo-position)))
- (gnugo-push-move t pos) ; value always nil for non-pass move
- (gnugo--finish-move buf)
- (with-current-buffer buf
- (gnugo-get-move (gnugo-get :gnugo-color)))))
+ (gnugo--user-play (gnugo-position)))
(defun gnugo-mouse-move (e)
"Do `gnugo-move' at mouse location."
@@ -1693,13 +1696,7 @@ To start a game try M-x gnugo."
Signal error if done out-of-turn or if game-over.
To start a game try M-x gnugo."
(interactive)
- (gnugo-gate t)
- (let ((donep (gnugo-push-move t "PASS"))
- (buf (current-buffer)))
- (gnugo--finish-move buf)
- (unless donep
- (with-current-buffer buf
- (gnugo-get-move (gnugo-get :gnugo-color))))))
+ (gnugo--user-play "PASS"))
(defun gnugo-mouse-pass (e)
"Do `gnugo-pass' at mouse location."
- [elpa] externals/gnugo e382633 190/357: [gnugo] Drop var: gnugo-inhibit-refresh, (continued)
- [elpa] externals/gnugo e382633 190/357: [gnugo] Drop var: gnugo-inhibit-refresh, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo dd6b6f8 186/357: [gnugo] New command: ‘C’ (gnugo-comment), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cba406b 176/357: [gnugo] Include root node in :sgf-gametree description., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1ac646f 172/357: [gnugo] New command: ‘O’ (gnugo-okay), Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3f13bbf 168/357: [gnugo] Make ‘=’ also display move number., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f3c90cd 187/357: [gnugo] Make ‘C-u F’ add the blurb as a comment to the last node., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bcc912b 164/357: [gnugo frolic int] Add var selection to awakening parameterization., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5bbec0e 179/357: [gnugo int] Incorporate ‘gnugo-note’ into unique caller., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 82b6000 198/357: [gnugo] Mention ‘gnugo-frolic-mode-hook’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnugo--user-play,
Stefan Monnier <=
- [elpa] externals/gnugo 001228c 205/357: [gnugo] Drop support for ‘(gnugo-move-history 'count)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 106a279 211/357: [gnugo int] Consolidate paren overlays access., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 17d907d 210/357: [gnugo int] Shave one ‘gnugo-other’ call., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 167ba89 213/357: [gnugo int] Decruft: Streamline game-over handling on SGF load., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b3d3da0 220/357: [gnugo int] Use functional style more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e96b88b 218/357: [gnugo] Decruft: Use ‘gnugo-program’ directly as executable., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3670b0b 228/357: [gnugo] On SGF load, leave cursor at last user board position., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1020a7f 237/357: [gnugo int] Simplify towards-root loop termination check., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7114ed6 234/357: [gnugo int] Add abstraction: gnugo--mem-with-played-stone, Stefan Monnier, 2020/11/29