summaryrefslogtreecommitdiff
path: root/chess-gnuchess.el
blob: 1031f4fc5d9387b725f9bd9f5703ef7f3cb26040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Play against the gnuchess engine
;;
;; $Revision$

(require 'chess-process)

(defgroup chess-gnuchess nil
  "Interface code for playing against gnuchess.  Uses `chess-process'."
  :group 'chess)

(defcustom chess-gnuchess-command "gnuchess"
  "The name of the gnuchess program."
  :type 'string
  :group 'chess-gnuchess)

;;;###autoload
(defun chess-gnuchess (game)
  (chess-process
   game nil
   (list (list (concat "My move is : \\(" chess-algebraic-regexp "\\)")
	       (function
		(lambda (move)
		  (chess-game-move chess-process-game move nil))) 1)
	 '("Illegal move:" (error "Illegal move")))
   (if (file-name-absolute-p chess-gnuchess-command)
       chess-gnuchess-command
     (executable-find chess-gnuchess-command))))

(provide 'chess-gnuchess)

;;; chess-gnuchess.el ends here