1 ;;; chess-fruit.el --- Play against fruit!
3 ;; Copyright (C) 2014 Free Software Foundation, Inc.
5 ;; Author: Mario Lang <mlang@delysid.org>
6 ;; Keywords: games, processes
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
25 (defgroup chess-fruit nil
26 "The publically available chess engine 'fruit'."
28 :link '(url-link "http://www.fruitchess.com/"))
30 (defcustom chess-fruit-path (executable-find "fruit")
31 "*The path to the fruit executable."
35 (defvar chess-fruit-regexp-alist chess-uci-regexp-alist
36 "Patterns used to match engine output.")
38 (defun chess-fruit-handler (game event &rest args)
39 (unless chess-engine-handling-event
41 ((eq event 'initialize)
42 (let ((proc (chess-uci-handler game 'initialize "fruit")))
43 (when (and proc (processp proc) (eq (process-status proc) 'run))
44 (process-send-string proc "uci\n")
45 (setq chess-engine-process proc)
49 (if (and (eq event 'undo)
50 (= 1 (mod (car args) 2)))
51 (error "Cannot undo until after fruit moves"))
53 (apply 'chess-uci-handler game event args)))))
55 (provide 'chess-fruit)
57 ;;; chess-fruit.el ends here