summaryrefslogtreecommitdiff
path: root/chess-gnuchess.el
diff options
context:
space:
mode:
Diffstat (limited to 'chess-gnuchess.el')
-rw-r--r--chess-gnuchess.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/chess-gnuchess.el b/chess-gnuchess.el
index 48803ea..e7f2aa4 100644
--- a/chess-gnuchess.el
+++ b/chess-gnuchess.el
@@ -58,13 +58,19 @@
(delete-file file)))))
((eq event 'setup)
- (let ((file (make-temp-file "gch")))
- (with-temp-file file
- (insert (chess-pos-to-fen (car args)) ?\n))
- (chess-engine-send nil (format "epdload %s\n" file))
- (push file chess-gnuchess-temp-files)))
+ (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))
+ (chess-engine-send nil (format "epdload %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))
+ "white" "black")
+ "\n"))
(chess-engine-send nil "go\n"))
((eq event 'move)