diff options
Diffstat (limited to 'chess-gnuchess.el')
| -rw-r--r-- | chess-gnuchess.el | 16 |
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)) |
