diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-10 21:08:12 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-10 21:08:12 +0000 |
| commit | d50c928242180a7f3e75d9d4deebca1a4dc8141c (patch) | |
| tree | fb01390359731d1397cb52f927161bcad9cf22b3 /chess-network.el | |
| parent | fa6d9924972f0472c2f05d10d2909e20e8af7b4b (diff) | |
lots of work, several new event types, better support in chess-engine
for establishing the starting game position
Diffstat (limited to 'chess-network.el')
| -rw-r--r-- | chess-network.el | 26 |
1 files changed, 22 insertions, 4 deletions
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")) |
