summaryrefslogtreecommitdiff
path: root/chess-network.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-10 22:58:11 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-10 22:58:11 +0000
commite0d27e16375133dbc77778a5787842017673dc4b (patch)
tree62b655407aef0c7ed26e05bee32c505dc2242493 /chess-network.el
parentfa6fd6dc166f6d333ddb9c94271647956f86598d (diff)
added support in chess-link.el to link two engines together. if both
are computers, then they will play head to head
Diffstat (limited to 'chess-network.el')
-rw-r--r--chess-network.el75
1 files changed, 38 insertions, 37 deletions
diff --git a/chess-network.el b/chess-network.el
index b48f776..a4befa2 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -9,43 +9,44 @@
(require 'chess-algebraic)
(defvar chess-network-regexp-alist
- (list (cons (concat chess-algebraic-regexp "$")
- (function
- (lambda ()
- (funcall chess-engine-response-handler 'move
- (match-string 0)))))
- (cons "chess match\\(\\s-+\\(.+\\)\\)?$"
- (function
- (lambda ()
- (funcall chess-engine-response-handler 'connect
- (match-string 2)))))
- (cons "accept\\(\\s-+\\(.+\\)\\)?$"
- (function
- (lambda ()
- (funcall chess-engine-response-handler 'accept
- (match-string 2)))))
- (cons "fen\\s-+\\(.+\\)"
- (function
- (lambda ()
- (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
- (lambda ()
- (funcall chess-engine-response-handler 'pass))))
- (cons "quit$"
- (function
- (lambda ()
- (funcall chess-engine-response-handler 'quit))))
- (cons "resign$"
- (function
- (lambda ()
- (funcall chess-engine-response-handler 'resign))))))
+ (list
+ (cons (concat chess-algebraic-regexp "$")
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'move
+ (chess-engine-convert-algebraic (match-string 0))))))
+ (cons "chess match\\(\\s-+\\(.+\\)\\)?$"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'connect
+ (match-string 2)))))
+ (cons "accept\\(\\s-+\\(.+\\)\\)?$"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'accept
+ (match-string 2)))))
+ (cons "fen\\s-+\\(.+\\)"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'setup-pos
+ (chess-engine-convert-fen (match-string 1))))))
+ (cons "pgn\\s-+\\(.+\\)"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'setup-game
+ (chess-engine-convert-pgn (match-string 1))))))
+ (cons "pass$"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'pass))))
+ (cons "quit$"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'quit))))
+ (cons "resign$"
+ (function
+ (lambda ()
+ (funcall chess-engine-response-handler 'resign))))))
(defun chess-network-handler (event &rest args)
"Initialize the network chess engine."