eschulte pushed a commit to branch go in repository elpa. commit e4433ecfab18a39ea6b5806e7423ac507361ec37 Author: Eric Schulte <eric.schu...@gmx.com> Date: Sun May 27 16:50:29 2012 -0600
cleanup in go.el --- back-ends/gnugo.el | 2 +- back-ends/gtp.el | 3 +-- back-ends/igs.el | 3 +-- back-ends/sgf.el | 3 +-- go-board.el | 12 +----------- go-tests.el | 6 +++--- go.el | 18 ++++++++++++++++-- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/back-ends/gnugo.el b/back-ends/gnugo.el index ab4e0f0..5cf9fca 100644 --- a/back-ends/gnugo.el +++ b/back-ends/gnugo.el @@ -26,7 +26,7 @@ ;; Boston, MA 02110-1301, USA. ;;; CODE: -(require 'go-util) +(require 'go) (require 'gtp) (require 'comint) diff --git a/back-ends/gtp.el b/back-ends/gtp.el index 512265a..7a2321c 100644 --- a/back-ends/gtp.el +++ b/back-ends/gtp.el @@ -32,8 +32,7 @@ ;; The GMP command set may be implemented as an extension. ;; Code: -(require 'go-util) -(require 'go-trans) +(require 'go) (defun gtp-expand-color (turn) (case turn diff --git a/back-ends/igs.el b/back-ends/igs.el index 7a6659f..5d3ef40 100644 --- a/back-ends/igs.el +++ b/back-ends/igs.el @@ -30,7 +30,6 @@ ;; http://www.pandanet.co.jp/English/commands/term/Summary.html ;; Code: -(require 'go-util) -(require 'go-trans) +(require 'go) (provide 'igs) diff --git a/back-ends/sgf.el b/back-ends/sgf.el index 00580e6..4a0c6e0 100644 --- a/back-ends/sgf.el +++ b/back-ends/sgf.el @@ -30,8 +30,7 @@ ;; This file implements an `go-trans' interface into an SGF file. ;; Code: -(require 'go-util) -(require 'go-trans) +(require 'go) (defun sgf-nthcdr (sgf index) (let ((part sgf)) diff --git a/go-board.el b/go-board.el index d0eb59c..6d1b239 100644 --- a/go-board.el +++ b/go-board.el @@ -26,8 +26,7 @@ ;; Boston, MA 02110-1301, USA. ;;; Code: -(require 'go-util) -(require 'go-trans) +(require 'go) (require 'go-board-faces) (defvar *history* nil "Holds the board history for a GO buffer.") @@ -331,13 +330,4 @@ (define-derived-mode go-board-mode nil "GO" "Major mode for viewing a GO board.") -(defun go-board-play (&optional level) - (interactive "P") - (let ((*autoplay* t)) - (go-board - (make-instance 'gnugo - :buffer (apply #'gnugo-start-process - (when level - (list "--level" (number-to-string level)))))))) - (provide 'go-board) diff --git a/go-tests.el b/go-tests.el index d5b7bd9..8789980 100644 --- a/go-tests.el +++ b/go-tests.el @@ -26,13 +26,13 @@ ;; Boston, MA 02110-1301, USA. ;;; Code: -(require 'go-util) -(require 'sgf2el) +(require 'ert) +(require 'go) (require 'go-board) (require 'gtp) (require 'gnugo) (require 'sgf) -(require 'ert) +(require 'sgf2el) ;;; sgf2el tests diff --git a/go.el b/go.el index 37394af..a33519c 100644 --- a/go.el +++ b/go.el @@ -1,4 +1,4 @@ -;;; go-trans.el --- Translate and transfer between GO back ends +;;; go.el --- Play GO, translate and transfer between GO back ends ;; Copyright (C) 2012 Eric Schulte <eric.schu...@gmx.com> @@ -37,6 +37,9 @@ (require 'go-util) (require 'eieio) +(declare-function go-board "go-board" (back-end &rest trackers)) +(declare-function gnugo-start-process "gnugo.el" (&rest options)) + (put 'unsupported-back-end-command 'error-conditions '(error unsupported-back-end-command)) @@ -52,6 +55,17 @@ (defgeneric ,set-name (back-end new)) (defsetf ,name ,set-name)))) +(defun play-go (&optional level) + "Play a game of GO against gnugo. +Optional argument LEVEL specifies gnugo's level of play." + (interactive "P") + (let ((*autoplay* t)) + (go-board + (make-instance 'gnugo + :buffer (apply #'gnugo-start-process + (when level + (list "--level" (number-to-string level)))))))) + ;; setf'able back-end access (defgeneric-w-setf go-size "Access BACK-END size.") (defgeneric-w-setf go-name "Access BACK-END name.") @@ -67,4 +81,4 @@ (defgeneric go-resign (back-end) "Send resign to BACK-END.") (defgeneric go-reset (back-end) "Send reset to BACK-END.") -(provide 'go-trans) +(provide 'go)