From b60fd83dd950c2c5ef04f23f25bf0d25ac9c11db Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 8 Apr 2002 03:37:26 +0000 Subject: Simplified the code, removed the 'search-function' nonsense. Even the wackiest chess variants use standard move notation. `chess-ply-create' now fully validates and annotates the plies that it creates, based on the initial piece move (such as the king, in the case of castling). --- chess-engine.el | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'chess-engine.el') diff --git a/chess-engine.el b/chess-engine.el index 19bd4cc..bfd30c7 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -17,14 +17,12 @@ (defvar chess-engine-response-handler nil) (defvar chess-engine-position nil) (defvar chess-engine-game nil) -(defvar chess-engine-search-function nil) (make-variable-buffer-local 'chess-engine-regexp-alist) (make-variable-buffer-local 'chess-engine-event-handler) (make-variable-buffer-local 'chess-engine-response-handler) (make-variable-buffer-local 'chess-engine-position) (make-variable-buffer-local 'chess-engine-game) -(make-variable-buffer-local 'chess-engine-search-function) (defvar chess-engine-last-pos nil) (defvar chess-engine-working nil) @@ -58,7 +56,7 @@ ((eq event 'move) (chess-engine-do-move (car args))))) -(defun chess-engine-create (module &optional user-handler search-func) +(defun chess-engine-create (module &optional user-handler) (let ((regexp-alist (intern-soft (concat (symbol-name module) "-regexp-alist"))) (handler (intern-soft (concat (symbol-name module) "-handler")))) @@ -83,23 +81,9 @@ (chess-with-current-buffer engine (apply chess-engine-event-handler event args))) -(defun chess-engine-search-function (engine) - (chess-with-current-buffer engine - (if chess-engine-game - (chess-game-search-function chess-engine-game) - (or chess-engine-search-function - 'chess-standard-search-position)))) - -(defun chess-engine-set-search-function (engine search-func) - (chess-with-current-buffer engine - (if chess-engine-game - (error "Engine is currently linked to a game") - (setq chess-engine-search-function search-func)))) - -(defsubst chess-engine-search-position (engine position target piece) - (chess-with-current-buffer engine - (funcall (chess-engine-search-function nil) - position target piece))) +;; 'ponder +;; 'search-depth +;; 'wall-clock (defun chess-engine-set-option (engine option value) (chess-with-current-buffer engine @@ -152,7 +136,7 @@ (chess-engine-do-move ply) (chess-engine-command engine 'move ply))) -(defun chess-engine-pass (engine ply) +(defun chess-engine-pass (engine) (chess-with-current-buffer engine (chess-engine-command engine 'pass))) -- cgit v1.2.3