From 871e9bb270b35c621265fc56ec582bdd39900e2a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 11 Mar 2002 20:57:21 +0000 Subject: changes --- chess-engines.el | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 chess-engines.el (limited to 'chess-engines.el') diff --git a/chess-engines.el b/chess-engines.el new file mode 100644 index 0000000..c014972 --- /dev/null +++ b/chess-engines.el @@ -0,0 +1,56 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Play against popular chess engines +;; +;; $Revision$ + +(require 'chess-process) + +(define-chess-engine crafty (&rest args) + (list (list + (concat "\\s-*\\(White\\|Black\\)\\s-*([0-9]+):\\s-+\\(" + chess-algebraic-regexp "\\)\\s-*$") + (function + (lambda (color move) + (if (string= (if (chess-game-side-to-move chess-process-game) + "White" "Black") + color) + (chess-session-event + chess-current-session 'move + (chess-algebraic-to-ply + (chess-game-pos chess-process-game) move))))) + 1 2) + '("Illegal move:\\s-*\\(.*\\)" + (signal 'chess-illegal (match-string 1)))) + (init (concat "display nogeneral\n" + "display nochanges\n" + "display noextstats\n" + "display nohashstats\n" + "display nomoves\n" + "display nonodes\n" + "display noply1\n" + "display nostats\n" + "display notime\n" + "display novariation\n" + "alarm off\n" + "ansi off")) + (shutdown "quit") + (move (chess-game-ply-to-algebraic chess-process-game (car args))) + (pass "go")) + +(define-chess-engine gnuchess (&rest args) + (list (list + (concat "My move is : \\(" chess-algebraic-regexp "\\)") + (function + (lambda (move) + (chess-session-event chess-current-session 'move + (chess-algebraic-to-ply + (chess-game-pos chess-process-game) move)))) + 1) + '("Illegal move:\\s-*\\(.*\\)" + (signal 'chess-illegal (match-string 1)))) + (shutdown "quit") + (move (chess-game-ply-to-algebraic chess-process-game (car args))) + (pass "go")) + +;;; chess-engines.el ends here -- cgit v1.2.3