summaryrefslogtreecommitdiff
path: root/chess-crafty.el
blob: 06b5451af95ae51169ec70995bbfd8a0bfc6d793 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Play against the crafty engine
;;
;; $Revision$

(require 'chess-process)

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

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

;;; Code:

;;;###autoload
(defun chess-crafty (session buffer event &rest args)
  (if (not (eq event 'initialize))
      (apply 'chess-process session buffer event args)
    (with-current-buffer
	(chess-process session buffer event
		       chess-process-triggers
		       (if (file-name-absolute-p chess-crafty-command)
			   chess-crafty-command
			 (executable-find chess-crafty-command)))
      (process-send-string
       (get-buffer-process (current-buffer))
       (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"))
      (current-buffer))))

(provide 'chess-crafty)

;;; chess-crafty.el ends here