diff options
| author | Mario Lang <mlang@delysid.org> | 2004-01-10 16:12:14 +0000 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2004-01-10 16:12:14 +0000 |
| commit | 8ac89522d46a29b61ab32254861762ab1a43f514 (patch) | |
| tree | c499b77745a947e3e9e3c0054ea47d64859594f6 | |
| parent | 63197d8e564f147bd41203bceb7dfbf15befbeae (diff) | |
Use Crafty's xboard protocol layer for communication:
Since recent >19.x crafty, there is something strange going on with
display nogeneral. Another bug which appears sometimes is that
crafty (in its own mode of displaying stuff) echos the oponent
move (our move) which raises an error (obviously).
xboard mode is really a lot easier to parse, and I even managed
to keep the 'evaluate event without any problems.
| -rw-r--r-- | chess-crafty.el | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/chess-crafty.el b/chess-crafty.el index 1f892ee..b6b0dac 100644 --- a/chess-crafty.el +++ b/chess-crafty.el @@ -21,17 +21,21 @@ (defvar chess-crafty-regexp-alist (list - (cons (concat "\\(White\\|Black\\)\\s-*([0-9]+):\\s-+\\(" + (cons (concat "move\\s-+\\(" chess-algebraic-regexp "\\)\\s-*$") (function (lambda () (funcall chess-engine-response-handler 'move - (chess-engine-convert-algebraic (match-string 2) t))))) + (chess-engine-convert-algebraic (match-string 1) t))))) (cons "total evaluation\\.+\\s-+\\([-+0-9.]+\\)" (function (lambda () (setq chess-crafty-evaluation (string-to-number (match-string 1)))))) + (cons "tellicsnoalias kibitz Hello from\\s-+\\(.+\\)$" + (function + (lambda () + (setq chess-engine-opponent-name (match-string 1))))) (cons "{\\(Black\\|White\\) resigns}" (function (lambda () @@ -52,20 +56,8 @@ (let ((proc (chess-common-handler game 'initialize "crafty"))) (when (and proc (processp proc) (eq (process-status proc) 'run)) - (process-send-string proc (concat ;"display nogeneral\n" - "display nochanges\n" - "display noextstats\n" - "display nohashstats\n" - "display nomoves\n" - "display nonodes\n" - "display noply1\n" - "display nostats\n" - "display notime\n" - "display novariation\n" - "alarm off\n" - "ansi off\n")) - (setq chess-engine-process proc - chess-engine-opponent-name "Crafty") + (process-send-string proc (concat "xboard\n")) + (setq chess-engine-process proc) t))) ((eq event 'setup-pos) @@ -94,8 +86,8 @@ (chess-engine-send nil "resign -1\n"))) ((eq (car args) 'ponder) (if (cadr args) - (chess-engine-send nil "ponder on\n") - (chess-engine-send nil "ponder off\n"))))) + (chess-engine-send nil "hard\n") + (chess-engine-send nil "easy\n"))))) (t (if (and (eq event 'undo) |
