1 ;;; chess-fruit.el --- Play against fruit!
3 ;; Copyright (C) 2014 Free Software Foundation, Inc.
5 ;; Author: Mario Lang <mlang@delysid.org>
8 ;; This file 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 2, or (at your option)
13 ;; This file 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 GNU Emacs; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
27 (defgroup chess-fruit nil
28 "The publically available chess engine 'fruit'."
30 :link '(url-link "http://www.fruitchess.com/"))
32 (defcustom chess-fruit-path (executable-find "fruit")
33 "*The path to the fruit executable."
37 (defvar chess-fruit-regexp-alist chess-uci-regexp-alist
38 "Patterns used to match engine output.")
40 (defun chess-fruit-handler (game event &rest args)
41 (unless chess-engine-handling-event
43 ((eq event 'initialize)
44 (let ((proc (chess-uci-handler game 'initialize "fruit")))
45 (when (and proc (processp proc) (eq (process-status proc) 'run))
46 (process-send-string proc "uci\n")
47 (setq chess-engine-process proc)
51 (if (and (eq event 'undo)
52 (= 1 (mod (car args) 2)))
53 (error "Cannot undo until after fruit moves"))
55 (apply 'chess-uci-handler game event args)))))
57 (provide 'chess-fruit)
59 ;;; chess-fruit.el ends here