summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--chess-engine.el5
-rw-r--r--chess-network.el6
3 files changed, 11 insertions, 2 deletions
diff --git a/TODO b/TODO
index 6defde9..6a94b65 100644
--- a/TODO
+++ b/TODO
@@ -14,6 +14,8 @@
- Resize ascii windows after popup, so that the whole board is
minimally visible
+- Need a way to resign, request a draw, etc.
+
----------------------------------------------------------------------
- Port image display code to XEmacs
diff --git a/chess-engine.el b/chess-engine.el
index 4b6fc4c..eb61b17 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -143,7 +143,10 @@
(defun chess-engine-send (engine string)
(chess-with-current-buffer engine
- (process-send-string (get-buffer-process (current-buffer)) string)))
+ (let ((proc (get-buffer-process (current-buffer))))
+ (if (and proc (memq (process-status proc) '(run open)))
+ (process-send-string proc string)
+ (error "The engine you are using is no longer running")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
diff --git a/chess-network.el b/chess-network.el
index 5127055..6ef4126 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -31,7 +31,11 @@
(let* ((position (chess-fen-to-pos (match-string 1)))
(ply (chess-ply-create position)))
(chess-game-set-plies (chess-engine-game nil)
- (list ply))))))))
+ (list ply))))))
+ (cons "QUIT"
+ (function
+ (lambda ()
+ (message "Your opponent has quit playing"))))))
(defun chess-network-perform-move ()
(let ((position (chess-engine-position nil))