]> code.delx.au - gnu-emacs-elpa/blob - chess-none.el
use zerop
[gnu-emacs-elpa] / chess-none.el
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;
3 ;; A null engine, used when two humans play each on the same display.
4 ;;
5
6 (require 'chess-engine)
7
8 (defvar chess-none-regexp-alist nil)
9
10 (defun chess-none-handler (game event &rest args)
11 "An empty chess engine, used for fielding key events.
12 This is only useful when two humans are playing each other, in which
13 case this engine will do the job of accepting undos, handling
14 resignations, etc."
15 (unless chess-engine-handling-event
16 (cond
17 ((eq event 'initialize) t)
18
19 ((memq event '(resign abort))
20 (chess-engine-set-position nil))
21
22 ((eq event 'undo)
23 (chess-game-undo game (car args))))))
24
25 (provide 'chess-none)
26
27 ;;; chess-none.el ends here