From d50c928242180a7f3e75d9d4deebca1a4dc8141c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 10 Apr 2002 21:08:12 +0000 Subject: lots of work, several new event types, better support in chess-engine for establishing the starting game position --- chess-network.el | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'chess-network.el') diff --git a/chess-network.el b/chess-network.el index ebc3b8f..b48f776 100644 --- a/chess-network.el +++ b/chess-network.el @@ -27,7 +27,12 @@ (cons "fen\\s-+\\(.+\\)" (function (lambda () - (funcall chess-engine-response-handler 'setup + (funcall chess-engine-response-handler 'setup-pos + (match-string 1))))) + (cons "pgn\\s-+\\(.+\\)" + (function + (lambda () + (funcall chess-engine-response-handler 'setup-game (match-string 1))))) (cons "pass$" (function @@ -58,20 +63,33 @@ (read-string "Port: ")))) (if (eq which ?s) (message "Now waiting for your opponent to connect...") - (process-send-string proc (format "name %s\n" (user-full-name))) + (process-send-string proc (format "chess match %s\n" chess-full-name)) (message "You have connected; pass now or make your move.")) proc)) ((eq event 'shutdown) (chess-engine-send nil "quit\n")) - ((eq event 'setup) + ((eq event 'setup-pos) (chess-engine-send nil (format "fen %s\n" - (chess-pos-to-fen (car args))))) + (chess-pos-to-string (car args))))) + + ((eq event 'setup-game) + (chess-engine-send nil (format "pgn %s\n" + (chess-game-to-string (car args))))) ((eq event 'pass) (chess-engine-send nil "pass\n")) + ((eq event 'busy) + (chess-engine-send nil "playing\n")) + + ((eq event 'accept) + (chess-engine-send nil (format "accept %s\n" chess-full-name))) + + ((eq event 'decline) + (chess-engine-send nil "decline\n")) + ((eq event 'resign) (chess-engine-send nil "resign\n")) -- cgit v1.2.3