eschulte pushed a commit to branch go
in repository elpa.

commit d248fbe1d366a9f4918001ddb704d4dbab5063d2
Author: Eric Schulte <[email protected]>
Date:   Sun May 27 15:42:41 2012 -0600

    can now feed moves from gnugo through to sgf
---
 go-gtp.el |    5 +++--
 go-sgf.el |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/go-gtp.el b/go-gtp.el
index 68d774f..d236c2a 100644
--- a/go-gtp.el
+++ b/go-gtp.el
@@ -125,8 +125,9 @@
   (signal 'unsupported-back-end-command (list gtp :set-alt alt)))
 
 (defmethod go-color ((gtp gtp))
-  (let ((last (split-string (gtp-command gtp "last_move"))))
-    (case (intern (car last)) ('white :B) ('black :W))))
+  (case (condition-case err
+            (intern (car (split-string (gtp-command gtp "last_move"))))
+          (error 'white)) ('white :B) ('black :W)))
 
 (defmethod set-go-color ((gtp gtp) color)
   (signal 'unsupported-back-end-command (list gtp :set-color color)))
diff --git a/go-sgf.el b/go-sgf.el
index ab632bd..de9691a 100644
--- a/go-sgf.el
+++ b/go-sgf.el
@@ -120,11 +120,12 @@
       (prev sgf)
       (error "sgf: no more moves"))))
 
+;; TODO: currently this only works with linear sgf files w/o alternatives
 (defmethod set-go-move ((sgf sgf) move)
+  (next sgf)
   (if (current sgf)
-      ;; TODO: this overwrites rather than saving alternatives
       (setf (current sgf) (list move))
-    (rpush (list move) (go-sgf-ref (self sgf) (butlast (index sgf))))))
+    (setf (self sgf) (rcons (list move) (self sgf)))))
 
 (defmethod go-labels ((sgf sgf))
   (let ((turn (current sgf)))

Reply via email to