summaryrefslogtreecommitdiff
path: root/chess-none.el
blob: efc3afe107c4b12cce524f2e8d1ba51408cb0d5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; A null engine, used when two humans play against each other on the
;; same display.
;;

(require 'chess-engine)

(defvar chess-none-regexp-alist nil)

(defun chess-none-handler (game event &rest args)
  "An empty chess engine, used for fielding key events.
This is only useful when two humans are playing each other, in which
case this engine will do the job of accepting undos, handling
resignations, etc."
  (unless chess-engine-handling-event
    (cond
     ((eq event 'initialize) t)

     ((memq event '(resign abort))
      (chess-engine-set-position nil))

     ((eq event 'undo)
      (chess-game-undo game (car args))))))

(provide 'chess-none)

;;; chess-none.el ends here