summaryrefslogtreecommitdiff
path: root/chess-network.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-10 21:08:12 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-10 21:08:12 +0000
commitd50c928242180a7f3e75d9d4deebca1a4dc8141c (patch)
treefb01390359731d1397cb52f927161bcad9cf22b3 /chess-network.el
parentfa6d9924972f0472c2f05d10d2909e20e8af7b4b (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.el26
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"))