summaryrefslogtreecommitdiff
path: root/chess-stockfish.el
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2014-03-24 14:44:39 +0100
committerMario Lang <mlang@delysid.org>2014-03-24 14:44:39 +0100
commit6b148f8d5cb39ee047db85fb5788abe8c9cd7f2b (patch)
tree6fa611d5b4d8c84f10aeaab31f9d86af87bcc103 /chess-stockfish.el
parent5130570807b16e7fceccaefb2d6b34502e31c1bb (diff)
Parse UCI long algebraic moves correctly.
Diffstat (limited to 'chess-stockfish.el')
-rw-r--r--chess-stockfish.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/chess-stockfish.el b/chess-stockfish.el
index f01c75b..21dc6a6 100644
--- a/chess-stockfish.el
+++ b/chess-stockfish.el
@@ -35,17 +35,18 @@
:group 'chess-stockfish)
(defvar chess-stockfish-regexp-alist
- (list
- (cons (concat "^bestmove\\s-+\\(" chess-algebraic-regexp "\\)")
- (function
- (lambda ()
- (message "move")
- (funcall chess-engine-response-handler 'move
- (chess-engine-convert-algebraic (match-string 1) t)))))
- (cons "^id\\s-+name\\s-+\\(.+\\)$"
- (function
- (lambda ()
- (setq-local chess-engine-opponent-name (match-string 1)))))))
+ (append
+ chess-uci-regexp-alist
+ (list
+ (cons (concat "^info\\s-+.*nps\\s-+\\([0-9]+\\).*pv\\s-+\\("
+ chess-uci-long-algebraic-regexp
+ "\\(\\s-+" chess-uci-long-algebraic-regexp "\\)+\\)")
+ (function
+ (lambda ()
+ (setq-local chess-stockfish-nps (string-to-number (match-string 1)))
+ (setq-local chess-stockfish-pv
+ (split-string (match-string 2) " ")))))))
+ "Patterns used to match stockfish output.")
(defun chess-stockfish-handler (game event &rest args)
(unless chess-engine-handling-event