diff options
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | chess-engine.el | 5 | ||||
| -rw-r--r-- | chess-network.el | 6 |
3 files changed, 11 insertions, 2 deletions
@@ -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)) |
