From d50c928242180a7f3e75d9d4deebca1a4dc8141c Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 10 Apr 2002 21:08:12 +0000 Subject: lots of work, several new event types, better support in chess-engine for establishing the starting game position --- chess-gnuchess.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'chess-gnuchess.el') 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)) -- cgit v1.2.3