summaryrefslogtreecommitdiff
path: root/chess-crafty.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-08 04:24:04 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-08 04:24:04 +0000
commitfe851e20e7c1a4f7da6478d1afebb5faa8dcc72d (patch)
tree7645c12c33a76057ec00049b355f26e1ffa27c74 /chess-crafty.el
parent5ed91ab211a09221adc51b8a2cdf17b61a132aa0 (diff)
Added support for network play
Diffstat (limited to 'chess-crafty.el')
-rw-r--r--chess-crafty.el26
1 files changed, 13 insertions, 13 deletions
diff --git a/chess-crafty.el b/chess-crafty.el
index 245b350..0bdc782 100644
--- a/chess-crafty.el
+++ b/chess-crafty.el
@@ -14,24 +14,24 @@
(list (cons
(concat "\\s-*\\(White\\|Black\\)\\s-*([0-9]+):\\s-+\\("
chess-algebraic-regexp "\\)\\s-*$")
- (function
- (lambda ()
- (let ((position (chess-engine-position nil))
- (move (match-string 2))
- ply)
- (when (string= (if (chess-pos-side-to-move position)
- "White" "Black")
- (match-string 1))
- (setq ply (chess-algebraic-to-ply position move))
- (unless ply
- (error "Could not convert engine move: %s" move))
- (let ((chess-crafty-now-moving t))
- (funcall chess-engine-response-handler 'move ply)))))))
+ 'chess-crafty-perform-move)
(cons "Illegal move:\\s-*\\(.*\\)"
(function
(lambda ()
(signal 'chess-illegal (match-string 1)))))))
+(defun chess-crafty-perform-move ()
+ (let ((position (chess-engine-position nil))
+ (move (match-string 2)) ply)
+ (when (string= (if (chess-pos-side-to-move position)
+ "White" "Black")
+ (match-string 1))
+ (setq ply (chess-algebraic-to-ply position move))
+ (unless ply
+ (error "Could not convert engine move: %s" move))
+ (let ((chess-crafty-now-moving t))
+ (funcall chess-engine-response-handler 'move ply)))))
+
(defun chess-crafty-handler (event &rest args)
(cond
((eq event 'initialize)