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

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

[elpa] 100/255: automated playing with gnugo


From: Eric Schulte
Subject: [elpa] 100/255: automated playing with gnugo
Date: Sun, 16 Mar 2014 01:02:27 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit bc298171c663830d992956a23304ee973fd98c40
Author: Eric Schulte <address@hidden>
Date:   Sat May 26 17:24:02 2012 -0600

    automated playing with gnugo
---
 go-board.el |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/go-board.el b/go-board.el
index c1e4c02..c477a43 100644
--- a/go-board.el
+++ b/go-board.el
@@ -34,6 +34,7 @@
 (defvar *turn*     nil "Holds the color of the current turn.")
 (defvar *back-end* nil "Holds the primary back-end connected to a board.")
 (defvar *trackers* nil "Holds a list of back-ends which should track the 
game.")
+(defvar *autoplay* nil "Should `*back-end*' automatically respond to moves.")
 
 (defvar black-piece "X")
 (defvar white-piece "O")
@@ -256,7 +257,8 @@
     (with-backends back
       (go->move back move))
     (apply-turn-to-board (list move))
-    (setf *turn* (other-color *turn*))))
+    (setf *turn* (other-color *turn*)))
+  (when *autoplay* (go-board-next)))
 
 (defun go-board-act-resign ()
   (interactive)
@@ -306,9 +308,11 @@
 
 (defun go-board-play (&optional level)
   (interactive "P")
-  (go-board-display
-   (make-instance 'gnugo
-     :buffer (apply #'go-gnugo-start-process
-                    (when level (list "--level" (number-to-string level)))))))
+  (let ((*autoplay* t))
+    (go-board-display
+     (make-instance 'gnugo
+       :buffer (apply #'go-gnugo-start-process
+                      (when level
+                        (list "--level" (number-to-string level))))))))
 
 (provide 'go-board)



reply via email to

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