]> code.delx.au - gnu-emacs-elpa/blob - chess-none.el
(chess-display-highlight-move): Simplify.
[gnu-emacs-elpa] / chess-none.el
1 ;;; chess-none.el --- Null engine
2
3 ;; Copyright (C) 2014 Free Software Foundation, Inc.
4
5 ;; This is free software; you can redistribute it and/or modify it under
6 ;; the terms of the GNU General Public License as published by the Free
7 ;; Software Foundation; either version 3, or (at your option) any later
8 ;; version.
9 ;;
10 ;; This is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 ;; for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; A null engine, used when two humans play against each other on the
21 ;; same display.
22
23 ;;; Code:
24
25 (require 'chess-engine)
26
27 (defvar chess-none-regexp-alist nil)
28
29 (defun chess-none-handler (game event &rest args)
30 "An empty chess engine, used for fielding key events.
31 This is only useful when two humans are playing each other, in which
32 case this engine will do the job of accepting undos, handling
33 resignations, etc."
34 (unless chess-engine-handling-event
35 (cond
36 ((eq event 'initialize) t)
37
38 ((memq event '(resign abort))
39 (chess-engine-set-position nil))
40
41 ((eq event 'undo)
42 (chess-game-undo game (car args))))))
43
44 (provide 'chess-none)
45
46 ;;; chess-none.el ends here