summaryrefslogtreecommitdiff
path: root/chess-crafty.el
diff options
context:
space:
mode:
Diffstat (limited to 'chess-crafty.el')
-rw-r--r--chess-crafty.el36
1 files changed, 36 insertions, 0 deletions
diff --git a/chess-crafty.el b/chess-crafty.el
new file mode 100644
index 0000000..51ca30a
--- /dev/null
+++ b/chess-crafty.el
@@ -0,0 +1,36 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; 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)
+
+;;;###autoload
+(defun chess-crafty (game)
+ (chess-process game 'chess-crafty-handler nil
+ (if (file-name-absolute-p chess-crafty-command)
+ chess-crafty-command
+ (executable-find chess-crafty-command))))
+
+;;; Code:
+
+(defun chess-crafty-handler (game buffer command &rest args)
+ (unless (apply 'chess-process-handler game buffer command args)
+ (ignore
+ (if (eq command 'initialize)
+ (process-send-string (get-buffer-process buffer)
+ "alarm off\nansi off\n")))))
+
+(provide 'chess-crafty)
+
+;;; chess-crafty.el ends here