emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 192/255: two consecutive passes ends the game


From: Eric Schulte
Subject: [elpa] 192/255: two consecutive passes ends the game
Date: Sun, 16 Mar 2014 01:02:46 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit ae4640e754246ce4246dac78a0ce981ea6d25e10
Author: Eric Schulte <address@hidden>
Date:   Sun May 19 16:28:48 2013 -0600

    two consecutive passes ends the game
---
 go-board.el |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/go-board.el b/go-board.el
index 13f16ff..ff8488a 100644
--- a/go-board.el
+++ b/go-board.el
@@ -337,10 +337,11 @@
 
 (defmacro with-backends (sym &rest body)
   (declare (indent 1))
-  `(ignoring-unsupported
-    (prog1 (let ((,sym *back-end*)) ,@body)
-      (with-trackers ,sym ,@body))))
-(def-edebug-spec with-backends (place body))
+  `(save-window-excursion
+     (ignoring-unsupported
+      (prog1 (let ((,sym *back-end*)) ,@body)
+        (with-trackers ,sym ,@body)))))
+(def-edebug-spec with-backends (sexp body))
 
 (defvar go-board-actions '(move resign undo comment)
   "List of actions which may be taken on an GO board.")
@@ -386,8 +387,12 @@
 (defun go-board-pass ()
   (interactive)
   (with-backends back (go-pass back))
-  (setf *turn* (other-color *turn*))
-  (when *autoplay* (go-board-next)))
+  (save-window-excursion
+    (setf *turn* (other-color *turn*))
+    (when *autoplay*
+      (when (equalp :pass (go-board-next))
+        ;; TODO: print the score
+        (message "Game Over")))))
 
 (defun go-board-undo (&optional num)
   (interactive "p")
@@ -406,8 +411,9 @@
 
 (defun go-board-next (&optional count)
   (interactive "p")
-  (dotimes (n (or count 1) (or count 1))
-    (let ((move (go-move *back-end*)))
+  (let (move)
+    (dotimes (n (or count 1) move)
+      (setf move (go-move *back-end*))
       (if (equal move :pass)
           (message "pass")
         (setf *turn* (other-color *turn*))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]