summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-05-01 07:46:10 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-05-01 07:46:10 +0000
commitb49698115d01ea6d055263bb2ce815c879b04413 (patch)
treee6a47c66a00b45f0eef5c20bf15f96f83810e730
parent3d3bbb7d7de849b139e612ad069a530c8ef9c342 (diff)
fixes
-rw-r--r--chess-database.el2
-rw-r--r--chess-gnuchess.el5
-rw-r--r--chess-scid.el37
3 files changed, 35 insertions, 9 deletions
diff --git a/chess-database.el b/chess-database.el
index 4903884..c9ad6dc 100644
--- a/chess-database.el
+++ b/chess-database.el
@@ -57,7 +57,7 @@
(when (buffer-live-p buf)
(with-current-buffer buf
(remove-hook 'kill-buffer-hook 'chess-database-close t))
- (chess-database-command buf 'save)
+ (chess-database-save buf)
(chess-database-command buf 'close)
(kill-buffer buf))))
diff --git a/chess-gnuchess.el b/chess-gnuchess.el
index 5281774..5de6a73 100644
--- a/chess-gnuchess.el
+++ b/chess-gnuchess.el
@@ -44,7 +44,7 @@
(when (and (processp proc)
(eq (process-status proc) 'run))
(process-send-string proc "nopost\n")
- (setq chess-engine-opponent-name "Crafty")
+ (setq chess-engine-opponent-name "GnuChess")
t)))
((eq event 'setup-pos)
@@ -68,8 +68,7 @@
(setq chess-gnuchess-bad-board nil))
((eq event 'move)
- (chess-engine-send nil (concat (chess-ply-to-algebraic (car args))
- "\n"))
+ (chess-common-handler game 'move (car args))
(when chess-gnuchess-bad-board
(chess-engine-send nil "go\n")
(setq chess-gnuchess-bad-board nil)))
diff --git a/chess-scid.el b/chess-scid.el
index ce526d9..0813b90 100644
--- a/chess-scid.el
+++ b/chess-scid.el
@@ -42,7 +42,9 @@
nil))))
((eq event 'close)
- (process-send-string chess-scid-process "sc_base close\nexit\n"))
+ (process-send-string chess-scid-process "sc_base close\nexit\n")
+ (while (eq (process-status chess-scid-process) 'run)
+ (sit-for 0 250)))
((eq event 'count)
(string-to-int (chess-scid-get-result "sc_base numGames\n")))
@@ -62,14 +64,39 @@
game)))
((eq event 'write)
- (chess-scid-handler 'replace 0 (car args)))
+ (chess-scid-handler 'replace (car args) 0))
((eq event 'replace)
(let ((index (or (cadr args)
(chess-game-data (car args) 'database-index))))
- (process-send-string chess-scid-process
- (format "sc_game import \"%s\"\n"
- (chess-game-to-string (cadr args))))
+ (process-send-string
+ chess-scid-process
+ (format "sc_game import \"%s\"\n"
+ (with-temp-buffer
+ (chess-pgn-insert-plies (car args) 1
+ (chess-game-plies (car args)))
+ (insert (or (chess-game-tag (car args) "Result") "*"))
+ (buffer-string))))
+ (dolist (tag (chess-game-tags (car args)))
+ ;; jww (2002-05-01): how do I set extra tags?
+ (unless (string= (car tag) "TimeControl")
+ (process-send-string
+ chess-scid-process
+ (concat "sc_game tags set "
+ (cond
+ ((string= (car tag) "Event") "-event")
+ ((string= (car tag) "Site") "-site")
+ ((string= (car tag) "Date") "-date")
+ ((string= (car tag) "Round") "-round")
+ ((string= (car tag) "White") "-white")
+ ((string= (car tag) "WhiteElo") "-whiteElo")
+ ((string= (car tag) "Black") "-black")
+ ((string= (car tag) "BlackElo") "-blackElo")
+ ((string= (car tag) "Result") "-result")
+ ((string= (car tag) "ECO") "-eco")
+ ((string= (car tag) "EventDate") "-eventdate")
+ ((string= (car tag) "Extra") "-extra"))
+ " \"" (cdr tag) "\"\n"))))
(process-send-string chess-scid-process
(format "sc_game save %d\n" index))))))