[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 05/06: [gnugo int] Add abstraction: gnugo--user-play
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 05/06: [gnugo int] Add abstraction: gnugo--user-play |
Date: |
Tue, 15 Apr 2014 19:19:48 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 37d4660365873ead48b82b6a3ea3f623f508cc2a
Author: Thien-Thi Nguyen <address@hidden>
Date: Tue Apr 15 21:15:27 2014 +0200
[gnugo int] Add abstraction: gnugo--user-play
* packages/gnugo/gnugo.el (gnugo--user-play): New func.
(gnugo-move, gnugo-pass): Use ‘gnugo--user-play’.
---
packages/gnugo/gnugo.el | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index b58ff35..f3952a6 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/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] branch master updated (6bafa60 -> 673ecf3), Thien-Thi Nguyen, 2014/04/15
- [elpa] 04/06: [gnugo] Mention ‘gnugo -frolic-mode-hook’., Thien-Thi Nguyen, 2014/04/15
- [elpa] 02/06: [gnugo int] Add abstraction: gnugo--ERR-wait, Thien-Thi Nguyen, 2014/04/15
- [elpa] 06/06: [gnugo int] Use ‘follo wing-char’ more., Thien-Thi Nguyen, 2014/04/15
- [elpa] 01/06: [gnugo] New command: ‘ C-c C-a’ (gnugo-toggle-abdication), Thien-Thi Nguyen, 2014/04/15
- [elpa] 05/06: [gnugo int] Add abstraction: gnugo--user-play,
Thien-Thi Nguyen <=
- [elpa] 03/06: [gnugo int] Add abstraction: gnugo--gate-game-over, Thien-Thi Nguyen, 2014/04/15