summaryrefslogtreecommitdiff
path: root/chess-engine.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-10 23:55:13 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-10 23:55:13 +0000
commita0769011c2a98841156559aa37978156766cc09f (patch)
tree407832c3c0fac049e9e7d567614894cc47e76f3c /chess-engine.el
parent5fbbfaf36f1dc7da3c7539568fe473bbf079c513 (diff)
Added support for aborting a game. Use A or N from a display.
Diffstat (limited to 'chess-engine.el')
-rw-r--r--chess-engine.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/chess-engine.el b/chess-engine.el
index ba85444..189ad15 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -128,7 +128,7 @@
;; accepting side
(unless game
(setq game (chess-engine-set-game nil (chess-game-create))))
- (chess-engine-set-start-position engine)
+ (chess-engine-set-start-position nil)
t))
((eq event 'setup-pos)
@@ -159,6 +159,12 @@
(when game
(chess-game-resign game)
(chess-game-set-data game 'active nil)
+ t))
+
+ ((eq event 'abort)
+ (when game
+ (message "Your opponent has aborted the game")
+ (chess-game-set-data game 'active nil)
t)))))
(defun chess-engine-create (module &optional response-handler &rest args)
@@ -311,6 +317,10 @@ function in all cases; this is merely a bandwidth-saver."
(chess-with-current-buffer engine
(chess-engine-command engine 'resign)))
+(defun chess-engine-abort (engine)
+ (chess-with-current-buffer engine
+ (chess-engine-command engine 'abort)))
+
(defun chess-engine-send (engine string)
"Send the given STRING to ENGINE."
(chess-with-current-buffer engine
@@ -372,7 +382,6 @@ function in all cases; this is merely a bandwidth-saver."
(if chess-engine-last-pos
(goto-char chess-engine-last-pos)
(goto-char (point-min)))
- (beginning-of-line)
(while (not (eobp))
(let ((triggers chess-engine-regexp-alist))
(while triggers