summaryrefslogtreecommitdiff
path: root/chess-gnuchess.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-03-01 06:17:46 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-03-01 06:17:46 +0000
commitf115e4627966ae900aef55cb10f9e6207dbe7adf (patch)
tree0718fd859aa8995889a1d7b7a5dc9007c39767df /chess-gnuchess.el
Initial revision
Diffstat (limited to 'chess-gnuchess.el')
-rw-r--r--chess-gnuchess.el33
1 files changed, 33 insertions, 0 deletions
diff --git a/chess-gnuchess.el b/chess-gnuchess.el
new file mode 100644
index 0000000..1031f4f
--- /dev/null
+++ b/chess-gnuchess.el
@@ -0,0 +1,33 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Play against the gnuchess engine
+;;
+;; $Revision$
+
+(require 'chess-process)
+
+(defgroup chess-gnuchess nil
+ "Interface code for playing against gnuchess. Uses `chess-process'."
+ :group 'chess)
+
+(defcustom chess-gnuchess-command "gnuchess"
+ "The name of the gnuchess program."
+ :type 'string
+ :group 'chess-gnuchess)
+
+;;;###autoload
+(defun chess-gnuchess (game)
+ (chess-process
+ game nil
+ (list (list (concat "My move is : \\(" chess-algebraic-regexp "\\)")
+ (function
+ (lambda (move)
+ (chess-game-move chess-process-game move nil))) 1)
+ '("Illegal move:" (error "Illegal move")))
+ (if (file-name-absolute-p chess-gnuchess-command)
+ chess-gnuchess-command
+ (executable-find chess-gnuchess-command))))
+
+(provide 'chess-gnuchess)
+
+;;; chess-gnuchess.el ends here