1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;; Play against gnuchess!
7 (require 'chess-engine)
9 (require 'chess-algebraic)
11 (defvar chess-gnuchess-regexp-alist
12 (list (cons (concat "My move is : \\(" chess-algebraic-regexp "\\)")
15 (funcall chess-engine-response-handler 'move
16 (chess-algebraic-to-ply (chess-engine-position nil)
21 (signal 'chess-illegal "Illegal move"))))))
23 (defun chess-gnuchess-handler (event &rest args)
25 ((eq event 'initialize)
27 (message "Starting chess program 'gnuchess'...")
28 (setq proc (start-process "chess-process" (current-buffer)
29 (executable-find "gnuchess")))
30 (message "Starting chess program 'gnuchess'...done")
33 (chess-engine-send nil "quit\n"))
35 (chess-engine-send nil (format "setboard %s\n"
36 (chess-pos-to-fen (car args)))))
38 (chess-engine-send nil "go\n"))
41 nil (concat (chess-ply-to-algebraic
43 (chess-engine-search-function nil)) "\n")))))
45 (provide 'chess-gnuchess)
47 ;;; chess-gnuchess.el ends here