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

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

[elpa] 99/255: single function to play gnugo


From: Eric Schulte
Subject: [elpa] 99/255: single function to play gnugo
Date: Sun, 16 Mar 2014 01:02:27 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit 6ea0389dcc00c9a3cec776aaf4b2f9a0406208fc
Author: Eric Schulte <address@hidden>
Date:   Sat May 26 16:46:00 2012 -0600

    single function to play gnugo
---
 go-board.el |    7 +++++++
 go-gnugo.el |    8 +++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/go-board.el b/go-board.el
index b13b273..c1e4c02 100644
--- a/go-board.el
+++ b/go-board.el
@@ -304,4 +304,11 @@
 (define-derived-mode go-board-mode nil "GO"
   "Major mode for viewing a GO board.")
 
+(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)))))))
+
 (provide 'go-board)
diff --git a/go-gnugo.el b/go-gnugo.el
index fa70a1e..738a45b 100644
--- a/go-gnugo.el
+++ b/go-gnugo.el
@@ -48,12 +48,12 @@
 (defvar go-gnugo-process-name "gnugo"
   "name for the gnugo process")
 
-(defun go-gnugo-start-process (&optional options)
+(defun go-gnugo-start-process (&rest options)
   (let ((buffer (apply 'make-comint
                        go-gnugo-process-name
                        go-gnugo-program nil
                        "--mode" "gtp" "--quiet"
-                       (when options (split-string options)))))
+                       options)))
     (with-current-buffer buffer (comint-mode))
     buffer))
 
@@ -89,9 +89,7 @@
 
 ;;; Class and interface
 (defclass gnugo (gtp)
-  ((buffer :initarg :buffer
-           :accessor buffer
-           :initform (go-gnugo-start-process))))
+  ((buffer :initarg :buffer :accessor buffer :initform nil)))
 
 (defmethod gtp-command ((gnugo gnugo) command)
   (go-gnugo-command-to-string gnugo command))



reply via email to

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