summaryrefslogtreecommitdiff
path: root/chess-crafty.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-15 00:58:29 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-15 00:58:29 +0000
commit7365cd3c961dece991bc67017afcc917359be69a (patch)
treef8ad41f8fc7d508a6c3b2324a184b91b0bdea65c /chess-crafty.el
parente15c5ad70e32debce094a3c53caf875afb648338 (diff)
*** no comment ***
Diffstat (limited to 'chess-crafty.el')
-rw-r--r--chess-crafty.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/chess-crafty.el b/chess-crafty.el
index 72b866e..be1e25b 100644
--- a/chess-crafty.el
+++ b/chess-crafty.el
@@ -17,6 +17,10 @@
:type 'file
:group 'chess-crafty)
+(defvar chess-crafty-evaluation nil)
+
+(make-variable-buffer-local 'chess-crafty-evaluation)
+
(defvar chess-crafty-regexp-alist
(list
(cons (concat "\\(White\\|Black\\)\\s-*([0-9]+):\\s-+\\("
@@ -25,6 +29,11 @@
(lambda ()
(funcall chess-engine-response-handler 'move
(chess-engine-convert-algebraic (match-string 2) t)))))
+ (cons "total evaluation\\.+\\s-+\\([-+0-9.]+\\)"
+ (function
+ (lambda ()
+ (setq chess-crafty-evaluation
+ (string-to-number (match-string 1))))))
(cons "\\(Illegal move\\|unrecognized/illegal command\\):\\s-*\\(.*\\)"
(function
(lambda ()
@@ -52,6 +61,15 @@
(chess-engine-send nil (format "setboard %s\n"
(chess-pos-to-string (car args)))))
+ ((eq event 'evaluate)
+ (setq chess-crafty-evaluation nil)
+ (chess-engine-send nil "display general\nscore\ndisplay nogeneral\n")
+ (let ((limit 50))
+ (while (and (null chess-crafty-evaluation)
+ (> (setq limit (1- limit)) 0))
+ (sit-for 0 100 t))
+ chess-crafty-evaluation))
+
((eq event 'setup-game)
(let ((file (chess-with-temp-file
(insert (chess-game-to-string (car args)) ?\n))))