summaryrefslogtreecommitdiff
path: root/chess-gnuchess.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-10 21:08:12 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-10 21:08:12 +0000
commitd50c928242180a7f3e75d9d4deebca1a4dc8141c (patch)
treefb01390359731d1397cb52f927161bcad9cf22b3 /chess-gnuchess.el
parentfa6d9924972f0472c2f05d10d2909e20e8af7b4b (diff)
lots of work, several new event types, better support in chess-engine
for establishing the starting game position
Diffstat (limited to 'chess-gnuchess.el')
-rw-r--r--chess-gnuchess.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/chess-gnuchess.el b/chess-gnuchess.el
index c26bf45..0e641fe 100644
--- a/chess-gnuchess.el
+++ b/chess-gnuchess.el
@@ -59,15 +59,27 @@
(if (file-exists-p file)
(delete-file file))))
- ((eq event 'setup)
+ ((eq event 'ready)
+ (let ((game (chess-engine-game nil)))
+ (if game
+ (chess-game-set-data game 'active t))))
+
+ ((eq event 'setup-pos)
(if (equal (car args) chess-starting-position)
(chess-engine-send nil "new\n")
(let ((file (make-temp-file "gch")))
(with-temp-file file
- (insert (chess-pos-to-fen (car args)) ?\n))
+ (insert (chess-pos-to-string (car args)) ?\n))
(chess-engine-send nil (format "epdload %s\n" file))
(push file chess-gnuchess-temp-files))))
+ ((eq event 'setup-game)
+ (let ((file (make-temp-file "gch")))
+ (with-temp-file file
+ (insert (chess-game-to-string (car args)) ?\n))
+ (chess-engine-send nil (format "pgnload %s\n" file))
+ (push file chess-gnuchess-temp-files)))
+
((eq event 'pass)
(chess-engine-send nil (concat (if (chess-pos-side-to-move
(chess-engine-position nil))