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

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

[elpa] 96/255: renaming sgf->go


From: Eric Schulte
Subject: [elpa] 96/255: renaming sgf->go
Date: Sun, 16 Mar 2014 01:02:27 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit c2aa4e500f8e920c9fde3a0cbdbeed923de2eade
Author: Eric Schulte <address@hidden>
Date:   Sat May 26 16:01:38 2012 -0600

    renaming sgf->go
---
 go-board.el |   82 ++++++++++++++++++++++++++--------------------------
 go-gnugo.el |   41 +++++++++++++-------------
 go-gtp.el   |   53 ++++++++++++++++-----------------
 go-igs.el   |    8 ++--
 go-sgf.el   |   40 +++++++++++++-------------
 go-tests.el |   92 +++++++++++++++++++++++++++++-----------------------------
 go-util.el  |    4 +-
 7 files changed, 159 insertions(+), 161 deletions(-)

diff --git a/go-board.el b/go-board.el
index 63e218e..a91ea17 100644
--- a/go-board.el
+++ b/go-board.el
@@ -1,4 +1,4 @@
-;;; sgf-board.el --- Smart Game Format GO board visualization
+;;; go-board.el --- Smart Game Format GO board visualization
 
 ;; Copyright (C) 2012 Eric Schulte <address@hidden>
 
@@ -26,8 +26,8 @@
 ;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
-(require 'sgf-util)
-(require 'sgf-trans)
+(require 'go-util)
+(require 'go-trans)
 
 (defvar *history*  nil "Holds the board history for a GO buffer.")
 (defvar *size*     nil "Holds the board size.")
@@ -189,22 +189,22 @@
             (board-to-string
              (pieces-to-board (car *history*) *size*))
             "\n\n")
-    (let ((comment (sgf<-comment *back-end*)))
+    (let ((comment (go<-comment *back-end*)))
       (when comment
         (insert (make-string (+ 6 (* 2 *size*)) ?=)
                 "\n\n"
                 comment)))
     (goto-char (point-min))))
 
-(defun sgf-board-display (back-end)
+(defun go-board-display (back-end)
   (let ((buffer (generate-new-buffer "*GO*")))
     (with-current-buffer buffer
-      (sgf-board-mode)
-      (when (sgf<-name back-end)
-        (rename-buffer (ear-muffs (sgf<-name back-end)) 'unique))
+      (go-board-mode)
+      (when (go<-name back-end)
+        (rename-buffer (ear-muffs (go<-name back-end)) 'unique))
       (set (make-local-variable '*back-end*) back-end)
       (set (make-local-variable '*turn*) :B)
-      (set (make-local-variable '*size*) (sgf<-size back-end))
+      (set (make-local-variable '*size*) (go<-size back-end))
       (set (make-local-variable '*history*)
            (list (board-to-pieces (make-board *size*))))
       (update-display (current-buffer)))
@@ -212,29 +212,29 @@
 
 
 ;;; User input
-(defvar sgf-board-actions '(move resign undo comment)
-  "List of actions which may be taken on an SGF board.")
+(defvar go-board-actions '(move resign undo comment)
+  "List of actions which may be taken on an GO board.")
 
-(defun sgf-board-act ()
-  "Send a command to the current SGF board."
+(defun go-board-act ()
+  "Send a command to the current GO board."
   (interactive)
   (let ((command (org-icompleting-read
-                  "Action: " (mapcar #'symbol-name sgf-board-actions))))
+                  "Action: " (mapcar #'symbol-name go-board-actions))))
     (case (intern command)
       (move    (message "make a move"))
       (resign  (message "game over"))
       (undo    (message "loser"))
       (comment (message "what?")))))
 
-(defun sgf-board-act-move (&optional pos)
+(defun go-board-act-move (&optional pos)
   (interactive)
   (let* ((color (case *turn* (:B "black") (:W "white")))
-         (pos (or pos (cons (sgf-gtp-char-to-num
+         (pos (or pos (cons (go-gtp-char-to-num
                              (aref (downcase
                                     (org-icompleting-read
                                      (format "[%s] X pos: " color)
                                      (mapcar #'string
-                                             (mapcar #'sgf-gtp-num-to-char
+                                             (mapcar #'go-gtp-num-to-char
                                                      (range 1 *size*)))))
                                    0))
                             (1- (string-to-number
@@ -244,54 +244,54 @@
                                           (range 1 *size*))))))))
          (move (cons *turn* (cons :pos pos))))
     (message "move:%S" move)
-    (sgf->move *back-end* move)
+    (go->move *back-end* move)
     (apply-turn-to-board (list move))
     (setf *turn* (other-color *turn*))))
 
-(defun sgf-board-act-resign ()
+(defun go-board-act-resign ()
   (interactive)
-  (sgf->reset *back-end*))
+  (go->reset *back-end*))
 
-(defun sgf-board-act-undo (&optional num)
+(defun go-board-act-undo (&optional num)
   (interactive "p")
-  (sgf->undo *back-end*)
+  (go->undo *back-end*)
   (pop *history*)
   (update-display (current-buffer))
   (setf *turn* (other-color *turn*)))
 
-(defun sgf-board-act-comment (&optional comment)
+(defun go-board-act-comment (&optional comment)
   (interactive "MComment: ")
   (message "comment: %S" comment))
 
-(defun sgf-board-next (&optional count)
+(defun go-board-next (&optional count)
   (interactive "p")
   (dotimes (n (or count 1) (or count 1))
-    (apply-turn-to-board (sgf<-turn *back-end* *turn*))
+    (apply-turn-to-board (go<-turn *back-end* *turn*))
     (setf *turn* (other-color *turn*))))
 
-(defun sgf-board-mouse-move (ev)
+(defun go-board-mouse-move (ev)
   (interactive "e")
-  (sgf-board-act-move (get-text-property (posn-point (event-start ev)) :pos)))
+  (go-board-act-move (get-text-property (posn-point (event-start ev)) :pos)))
 
 
 ;;; Display mode
-(defvar sgf-board-mode-map
+(defvar go-board-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "<down-mouse-1>") 'sgf-board-mouse-move)
-    (define-key map (kbd "m") 'sgf-board-act-move)
-    (define-key map (kbd "r") 'sgf-board-act-resign)
-    (define-key map (kbd "u") 'sgf-board-act-undo)
-    (define-key map (kbd "c") 'sgf-board-act-comment)
-    (define-key map (kbd "n") 'sgf-board-next)
-    (define-key map (kbd "p") 'sgf-board-act-undo)
-    (define-key map (kbd "<right>") 'sgf-board-next)
-    (define-key map (kbd "<left>")  'sgf-board-act-undo)
+    (define-key map (kbd "<down-mouse-1>") 'go-board-mouse-move)
+    (define-key map (kbd "m") 'go-board-act-move)
+    (define-key map (kbd "r") 'go-board-act-resign)
+    (define-key map (kbd "u") 'go-board-act-undo)
+    (define-key map (kbd "c") 'go-board-act-comment)
+    (define-key map (kbd "n") 'go-board-next)
+    (define-key map (kbd "p") 'go-board-act-undo)
+    (define-key map (kbd "<right>") 'go-board-next)
+    (define-key map (kbd "<left>")  'go-board-act-undo)
     (define-key map (kbd "q") (lambda () (interactive)
                                 (kill-buffer (current-buffer))))
     map)
-  "Keymap for `sgf-board-mode'.")
+  "Keymap for `go-board-mode'.")
 
-(define-derived-mode sgf-board-mode nil "SGF"
-  "Major mode for editing text written for viewing SGF files.")
+(define-derived-mode go-board-mode nil "GO"
+  "Major mode for viewing a GO board.")
 
-(provide 'sgf-board)
+(provide 'go-board)
diff --git a/go-gnugo.el b/go-gnugo.el
index 6925c28..fa70a1e 100644
--- a/go-gnugo.el
+++ b/go-gnugo.el
@@ -1,4 +1,4 @@
-;;; sgf-gnugo.el --- functions for interaction with a gnugo process using gtp
+;;; go-gnugo.el --- functions for interaction with a gnugo process using gtp
 
 ;; Copyright (C) 2008 2012 Eric Schulte <address@hidden>
 
@@ -30,48 +30,48 @@
 ;; Interaction with gnugo
 
 ;;; CODE:
-(require 'sgf-util)
-(require 'sgf-gtp)
+(require 'go-util)
+(require 'go-gtp)
 (require 'comint)
 
-(defun sgf-gnugo-gtp-commands ()
+(defun go-gnugo-gtp-commands ()
   "Return a list of the gnugo GTP commands."
   (split-string
    (substring
     (shell-command-to-string
-     (format "echo list_commands | %s --mode gtp" sgf-gnugo-program))
+     (format "echo list_commands | %s --mode gtp" go-gnugo-program))
     2 -2) "\n"))
 
-(defvar sgf-gnugo-program "gnugo"
+(defvar go-gnugo-program "gnugo"
   "path to gnugo executable")
 
-(defvar sgf-gnugo-process-name "gnugo"
+(defvar go-gnugo-process-name "gnugo"
   "name for the gnugo process")
 
-(defun sgf-gnugo-start-process (&optional options)
+(defun go-gnugo-start-process (&optional options)
   (let ((buffer (apply 'make-comint
-                       sgf-gnugo-process-name
-                       sgf-gnugo-program nil
+                       go-gnugo-process-name
+                       go-gnugo-program nil
                        "--mode" "gtp" "--quiet"
                        (when options (split-string options)))))
     (with-current-buffer buffer (comint-mode))
     buffer))
 
-(defun sgf-gnugo-command-to-string (gnugo command)
+(defun go-gnugo-command-to-string (gnugo command)
   "Send command to gnugo process and return gnugo's results as a string"
   (interactive "sgnugo command: ")
-  (sgf-gnugo-input-command gnugo command)
-  (sgf-gnugo-last-output gnugo))
+  (go-gnugo-input-command gnugo command)
+  (go-gnugo-last-output gnugo))
 
-(defun sgf-gnugo-input-command (gnugo command)
+(defun go-gnugo-input-command (gnugo command)
   "Pass COMMAND to the gnugo process running in the buffer of GNUGO."
   (with-current-buffer (buffer gnugo)
     (goto-char (process-mark (get-buffer-process (current-buffer))))
     (insert command)
     (comint-send-input))
-  (sgf-gnugo-wait-for-output gnugo))
+  (go-gnugo-wait-for-output gnugo))
 
-(defun sgf-gnugo-wait-for-output (gnugo)
+(defun go-gnugo-wait-for-output (gnugo)
   (with-current-buffer (buffer gnugo)
     (while (progn
             (goto-char comint-last-input-end)
@@ -80,7 +80,7 @@
         (error (match-string 1)))
       (accept-process-output (get-buffer-process (current-buffer))))))
 
-(defun sgf-gnugo-last-output (gnugo)
+(defun go-gnugo-last-output (gnugo)
   (with-current-buffer (buffer gnugo)
     (comint-show-output)
     (org-babel-clean-text-properties
@@ -91,10 +91,9 @@
 (defclass gnugo (gtp)
   ((buffer :initarg :buffer
            :accessor buffer
-           :initform (sgf-gnugo-start-process))))
+           :initform (go-gnugo-start-process))))
 
 (defmethod gtp-command ((gnugo gnugo) command)
-  (sgf-gnugo-command-to-string gnugo command))
+  (go-gnugo-command-to-string gnugo command))
 
-(provide 'sgf-gnugo)
-;;; sgf-gnugo.el ends here
+(provide 'go-gnugo)
diff --git a/go-gtp.el b/go-gtp.el
index 1e6cc0b..93576d1 100644
--- a/go-gtp.el
+++ b/go-gtp.el
@@ -1,4 +1,4 @@
-;;; sgf-gtp.el --- GTP backend for sgf-trans
+;;; go-gtp.el --- GTP backend for go-trans
 
 ;; Copyright (C) 2008 2012 Eric Schulte <address@hidden>
 
@@ -32,11 +32,11 @@
 ;; The GMP command set may be implemented as an extension.
 
 ;; Code:
-(require 'sgf-util)
-(require 'sgf-trans)
+(require 'go-util)
+(require 'go-trans)
 
-(defun sgf-gtp-char-to-num (char)
-  (flet ((err () (error "sgf-gtp: invalid char %s" char)))
+(defun go-gtp-char-to-num (char)
+  (flet ((err () (error "go-gtp: invalid char %s" char)))
     (cond
      ((< char ?A)  (err))
      ((< char ?I)  (- char ?A))
@@ -46,61 +46,60 @@
      ((<= char ?t) (1- (- char ?a)))
      (t (err)))))
 
-(defun sgf-gtp-num-to-char (num)
-  (flet ((err () (error "sgf: invalid num %s" num)))
+(defun go-gtp-num-to-char (num)
+  (flet ((err () (error "go: invalid num %s" num)))
     (cond
      ((< num 1) (err))
      ((< num 9) (+ ?A (1- num)))
      (t         (+ ?A num)))))
 
-(defun sgf-pos-to-gtp (pos)
+(defun go-pos-to-gtp (pos)
   (format "%c%d" (num-to-char (1+ (car pos))) (1+ (cdr pos))))
 
-(defun sgf-gtp-to-pos (color gtp)
-  (cons color (cons :pos (cons (sgf-gtp-char-to-num (aref gtp 0))
+(defun go-gtp-to-pos (color gtp)
+  (cons color (cons :pos (cons (go-gtp-char-to-num (aref gtp 0))
                                (1- (parse-integer (substring gtp 1)))))))
 
-(defun sgf-to-gtp-command (element)
-  "Convert an sgf ELEMENT to a gtp command."
+(defun go-to-gtp-command (element)
+  "Convert an go ELEMENT to a gtp command."
   (let ((key (car element))
        (val (cdr element)))
     (case key
-      (:B       (format "black %s" (sgf-pos-to-gtp (aget (list val) :pos))))
-      (:W       (format "white %s" (sgf-pos-to-gtp (aget (list val) :pos))))
+      (:B       (format "black %s" (go-pos-to-gtp (aget (list val) :pos))))
+      (:W       (format "white %s" (go-pos-to-gtp (aget (list val) :pos))))
       ((:SZ :S) (format "boardsize %s" val))
       (:KM      (format "komi %s" val))
       (t        nil))))
 
 
 ;;; Class and interface
-(defclass gtp nil nil "Class for the GTP SGF GO back end.")
+(defclass gtp nil nil "Class for the GTP GO GO back end.")
 
 (defgeneric gtp-command (back-end command)
   "Send gtp COMMAND to OBJECT and return any output.")
 
-(defmethod sgf->move ((gtp gtp) move)
-  (gtp-command gtp (sgf-to-gtp-command move)))
+(defmethod go->move ((gtp gtp) move)
+  (gtp-command gtp (go-to-gtp-command move)))
 
-(defmethod sgf<-size ((gtp gtp))
+(defmethod go<-size ((gtp gtp))
   (parse-integer (gtp-command gtp "query_boardsize")))
 
-(defmethod sgf<-name ((gtp gtp))
+(defmethod go<-name ((gtp gtp))
   (gtp-command gtp "name"))
 
-(defmethod sgf<-comment ((gtp gtp)) nil)
+(defmethod go<-comment ((gtp gtp)) nil)
 
-(defmethod sgf<-move ((gtp gtp) color)
-  (sgf-gtp-to-pos color
+(defmethod go<-move ((gtp gtp) color)
+  (go-gtp-to-pos color
                   (case color
                     (:B (gtp-command gtp "genmove_black"))
                     (:W (gtp-command gtp "genmove_white")))))
 
-(defmethod sgf<-turn ((gtp gtp) color) (list (sgf<-move gtp color)))
+(defmethod go<-turn ((gtp gtp) color) (list (go<-move gtp color)))
 
-(defmethod sgf->reset ((gtp gtp)) (gtp-command gtp "clear_board"))
+(defmethod go->reset ((gtp gtp)) (gtp-command gtp "clear_board"))
 
-(defmethod sgf->undo ((gtp gtp)) (gtp-command gtp "undo"))
+(defmethod go->undo ((gtp gtp)) (gtp-command gtp "undo"))
 
 
-(provide 'sgf-gtp)
-;;; sgf-gtp.el ends here
+(provide 'go-gtp)
diff --git a/go-igs.el b/go-igs.el
index 0fa20a0..56dce56 100644
--- a/go-igs.el
+++ b/go-igs.el
@@ -1,4 +1,4 @@
-;;; sgf-igs.el --- IGS backend for sgf-trans
+;;; go-igs.el --- IGS backend for go-trans
 
 ;; Copyright (C) 2012 Eric Schulte <address@hidden>
 
@@ -30,7 +30,7 @@
 ;; http://www.pandanet.co.jp/English/commands/term/Summary.html
 
 ;; Code:
-(require 'sgf-util)
-(require 'sgf-trans)
+(require 'go-util)
+(require 'go-trans)
 
-(provide 'sgf-igs)
+(provide 'go-igs)
diff --git a/go-sgf.el b/go-sgf.el
index ede5c43..05bf63a 100644
--- a/go-sgf.el
+++ b/go-sgf.el
@@ -1,4 +1,4 @@
-;;; sgf.el --- SGF back end
+;;; go-sgf.el --- SGF back end
 
 ;; Copyright (C) 2012 Eric Schulte <address@hidden>
 
@@ -27,13 +27,13 @@
 
 ;; Commentary:
 
-;; This file implements an `sgf-trans' interface into an SGF file.
+;; This file implements an `go-trans' interface into an SGF file.
 
 ;; Code:
-(require 'sgf-util)
-(require 'sgf-trans)
+(require 'go-util)
+(require 'go-trans)
 
-(defun sgf-nthcdr (sgf index)
+(defun go-sgf-nthcdr (sgf index)
   (let ((part sgf))
     (while (cdr index)
       (setq part (nth (car index) part))
@@ -41,19 +41,19 @@
     (setq part (nthcdr (car index) part))
     part))
 
-(defun sgf-ref (sgf index)
+(defun go-sgf-ref (sgf index)
   (let ((part sgf))
     (while (car index)
       (setq part (nth (car index) part))
       (setq index (cdr index)))
     part))
 
-(defun set-sgf-ref (sgf index new)
+(defun set-go-sgf-ref (sgf index new)
   (eval `(setf ,(reduce (lambda (acc el) (list 'nth el acc))
                         index :initial-value 'sgf)
                ',new)))
 
-(defsetf sgf-ref set-sgf-ref)
+(defsetf go-sgf-ref set-go-sgf-ref)
 
 
 ;;; Class and interface
@@ -68,39 +68,39 @@
 (defmethod root ((sgf sgf))
   (sgf-ref (self sgf) '(0)))
 
-(defmethod sgf->move ((sgf sgf) move))
+(defmethod go->move ((sgf sgf) move))
 
-(defmethod sgf->board ((sgf sgf) size))
+(defmethod go->board ((sgf sgf) size))
 
-(defmethod sgf->resign ((sgf sgf) resign))
+(defmethod go->resign ((sgf sgf) resign))
 
-(defmethod sgf->undo ((sgf sgf))
+(defmethod go->undo ((sgf sgf))
   (decf (car (last (index sgf))))
   (alistp (current sgf)))
 
-;; (defmethod sgf->comment ((sgf sgf) comment)
+;; (defmethod go->comment ((sgf sgf) comment)
 ;;   ;; TODO: need a setf method for current
 ;;   (push (cons :C comment) (current sgf)))
 
-(defmethod sgf<-size ((sgf sgf))
+(defmethod go<-size ((sgf sgf))
   (or (aget (root sgf) :S)
       (aget (root sgf) :SZ)))
 
-(defmethod sgf<-name ((sgf sgf))
+(defmethod go<-name ((sgf sgf))
   (or (aget (root sgf) :GN)
       (aget (root sgf) :EV)))
 
-(defmethod sgf<-alt ((sgf sgf)))
+(defmethod go<-alt ((sgf sgf)))
 
-(defmethod sgf<-turn ((sgf sgf) color)
+(defmethod go<-turn ((sgf sgf) color)
   (incf (car (last (index sgf))))
   (current sgf))
 
-(defmethod sgf<-comment ((sgf sgf))
+(defmethod go<-comment ((sgf sgf))
   (aget (current sgf) :C))
 
-(defun sgf-from-file (file)
+(defun go-from-file (file)
   (interactive "f")
   (make-instance 'sgf :self (sgf2el-file-to-el file)))
 
-(provide 'sgf)
+(provide 'go-sgf)
diff --git a/go-tests.el b/go-tests.el
index ca0432b..e657fef 100644
--- a/go-tests.el
+++ b/go-tests.el
@@ -1,4 +1,4 @@
-;;; sgf2el.el --- conversion between sgf and emacs-lisp
+;;; go-tests --- tests for varied GO functionality
 
 ;; Copyright (C) 2012 Eric Schulte <address@hidden>
 
@@ -26,17 +26,17 @@
 ;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
-(require 'sgf-util)
-(require 'sgf2el)
-(require 'sgf-board)
-(require 'sgf-gtp)
-(require 'sgf-gnugo)
-(require 'sgf)
+(require 'go-util)
+(require 'go2el)
+(require 'go-board)
+(require 'go-gtp)
+(require 'go-gnugo)
+(require 'go)
 (require 'ert)
 
 
 ;;; sgf2el tests
-(ert-deftest sgf-parse-simple-tree ()
+(ert-deftest go-sgf-parse-simple-tree ()
   (let* ((str "(;GM[1]FF[4]
                SZ[19]
                GN[GNU Go 3.7.11 load and print]
@@ -48,7 +48,7 @@
     (should (= 10 (length (first sgf))))
     (should (= 6  (length (car (last (first sgf))))))))
 
-(ert-deftest sgf-parse-nested-tree ()
+(ert-deftest go-sgf-parse-nested-tree ()
   (let* ((str "(;GM[1]FF[4]
                SZ[19]
                GN[GNU Go 3.7.11 load and print]
@@ -62,7 +62,7 @@
     (should (= 6 (length (car (first (second sgf))))))
     (should (= 6 (length (car (second (second sgf))))))))
 
-(ert-deftest sgf-parse-tree-w-weird-comment ()
+(ert-deftest go-parse-tree-w-weird-comment ()
   (let* ((str "(;B[kd]N[(c)]LB[ke:a][pf:b]
      C[Black 25 takes larger territory on top, and gives up
      larger territory at the right, as compared to variation
@@ -81,13 +81,13 @@
          (sgf (sgf2el-str-to-el str)))
     (should (= 3 (length sgf)))))
 
-(ert-deftest sgf-parse-file-test ()
+(ert-deftest go-parse-file-test ()
   (let ((sgf (sgf2el-file-to-el "sgf-files/jp-ming-5.sgf")))
     (should (= 247 (length sgf)))))
 
 
 ;;; board tests
-(ert-deftest sgf-empty-board-to-string-test ()
+(ert-deftest go-empty-board-to-string-test ()
   (let ((board (make-vector (* 19 19) nil))
         (string (concat "    A B C D E F G H J K L M N O P Q R S T\n"
                         " 19 . . . . . . . . . . . . . . . . . . . 19\n"
@@ -112,7 +112,7 @@
                         "    A B C D E F G H J K L M N O P Q R S T")))
     (should (string= string (board-to-string board)))))
 
-(ert-deftest sgf-non-empty-board-to-string-test ()
+(ert-deftest go-non-empty-board-to-string-test ()
   (let* ((joseki (sgf2el-file-to-el "sgf-files/3-4-joseki.sgf"))
          (root (car joseki))
          (rest (cdr joseki))
@@ -144,7 +144,7 @@
     (board-to-string board)
     (should t)))
 
-(ert-deftest sgf-neighbors ()
+(ert-deftest go-neighbors ()
   (let ((board (make-board 19)))
     (should (= 2 (length (neighbors board 0))))
     (should (= 2 (length (neighbors board (length board)))))
@@ -153,27 +153,27 @@
 
 
 ;;; GTP and gnugo tests
-(ert-deftest sgf-test-sgf-gtp-char-to-gtp ()
-  (should (= 1  (sgf-gtp-char-to-num ?A)))
-  (should (= 8  (sgf-gtp-char-to-num ?H)))
-  (should (= 9  (sgf-gtp-char-to-num ?J)))
-  (should (= 19 (sgf-gtp-char-to-num ?T)))
-  (should (= 1  (sgf-gtp-char-to-num ?a)))
-  (should (= 8  (sgf-gtp-char-to-num ?h)))
-  (should (= 9  (sgf-gtp-char-to-num ?j)))
-  (should (= 19 (sgf-gtp-char-to-num ?t))))
+(ert-deftest go-test-go-gtp-char-to-gtp ()
+  (should (= 1  (go-gtp-char-to-num ?A)))
+  (should (= 8  (go-gtp-char-to-num ?H)))
+  (should (= 9  (go-gtp-char-to-num ?J)))
+  (should (= 19 (go-gtp-char-to-num ?T)))
+  (should (= 1  (go-gtp-char-to-num ?a)))
+  (should (= 8  (go-gtp-char-to-num ?h)))
+  (should (= 9  (go-gtp-char-to-num ?j)))
+  (should (= 19 (go-gtp-char-to-num ?t))))
 
 (defmacro with-gnugo (&rest body)
   `(let (*gnugo*)
      (unwind-protect
          (progn
            (setf *gnugo* (make-instance 'gnugo))
-           (setf (buffer *gnugo*) (sgf-gnugo-start-process))
+           (setf (buffer *gnugo*) (go-gnugo-start-process))
            ,@body)
        (let ((kill-buffer-query-functions nil))
          (should (kill-buffer (buffer *gnugo*)))))))
 
-(ert-deftest sgf-test-gnugo-interaction-through-gtp ()
+(ert-deftest go-test-gnugo-interaction-through-gtp ()
   (let ((b1 (concat
              "\n"
              "   A B C D E F G H J K L M N O P Q R S T\n"
@@ -227,7 +227,7 @@
     (with-gnugo
      (should (string= b1 (gtp-command *gnugo* "showboard")))
      (should (string= "" (gtp-command *gnugo* "black A1")))
-     (should (string= "" (sgf->move   *gnugo* '(:B :pos . (0 . 1)))))
+     (should (string= "" (go->move   *gnugo* '(:B :pos . (0 . 1)))))
      (should (string= b2 (gtp-command *gnugo* "showboard"))))))
 
 
@@ -241,14 +241,14 @@
                      :index '(0)))
        ,@body)))
 
-(ert-deftest sgf-parse-empty-properties ()
+(ert-deftest go-parse-empty-properties ()
   (with-sgf-from-file "sgf-files/w-empty-properties.sgf"
     (should (remove-if-not (lambda (prop)
                              (let ((val (cdr prop)))
                                (and (sequencep val) (= 0 (length val)))))
                            (root *sgf*)))))
 
-(ert-deftest sgf-test-sgf-class-creation ()
+(ert-deftest go-test-sgf-class-creation ()
   (with-sgf-from-file "sgf-files/jp-ming-5.sgf"
     (should (tree-equal (index *sgf*) '(0)))
     (should (tree-equal (current *sgf*) (root *sgf*)))
@@ -260,7 +260,7 @@
 (defmacro with-sgf-display (file &rest body)
   (declare (indent 1))
   (let ((buffer (gensym "sgf-display-buffer")))
-    `(let ((,buffer (sgf-board-display
+    `(let ((,buffer (go-board-display
                      (make-instance 'sgf
                        :self (sgf2el-file-to-el ,file)
                        :index '(0)))))
@@ -268,14 +268,14 @@
          (should (kill-buffer ,buffer))))))
 (def-edebug-spec parse-many (file body))
 
-(ert-deftest sgf-display-fresh-sgf-buffer ()
+(ert-deftest go-display-fresh-go-buffer ()
   (with-sgf-display "sgf-files/3-4-joseki.sgf"
     (should *history*)
     (should *back-end*)))
 
-(ert-deftest sgf-independent-points-properties ()
+(ert-deftest go-independent-points-properties ()
   (with-sgf-display "sgf-files/3-4-joseki.sgf"
-    (sgf-board-next 4)
+    (go-board-next 4)
     (should (not (tree-equal (car *history*) (car (last *history*)))))))
 
 (defun stone-counts ()
@@ -285,24 +285,24 @@
                                       pieces))))
       (cons (count-for :B) (count-for :W)))))
 
-(ert-deftest sgf-singl-stone-capture ()
+(ert-deftest go-singl-stone-capture ()
   (with-sgf-display "sgf-files/1-capture.sgf"
-    (sgf-board-next 3) (should (tree-equal (stone-counts) '(2 . 0)))))
+    (go-board-next 3) (should (tree-equal (stone-counts) '(2 . 0)))))
 
-(ert-deftest sgf-remove-dead-stone-ko ()
+(ert-deftest go-remove-dead-stone-ko ()
   (with-sgf-display "sgf-files/ko.sgf"
-    (should (tree-equal (stone-counts) '(0 . 0))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(1 . 0))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(1 . 1))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(2 . 1))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(2 . 2))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(3 . 2))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(2 . 3))) (sgf-board-next)
-    (should (tree-equal (stone-counts) '(3 . 2))) (sgf-board-next)
+    (should (tree-equal (stone-counts) '(0 . 0))) (go-board-next)
+    (should (tree-equal (stone-counts) '(1 . 0))) (go-board-next)
+    (should (tree-equal (stone-counts) '(1 . 1))) (go-board-next)
+    (should (tree-equal (stone-counts) '(2 . 1))) (go-board-next)
+    (should (tree-equal (stone-counts) '(2 . 2))) (go-board-next)
+    (should (tree-equal (stone-counts) '(3 . 2))) (go-board-next)
+    (should (tree-equal (stone-counts) '(2 . 3))) (go-board-next)
+    (should (tree-equal (stone-counts) '(3 . 2))) (go-board-next)
     (should (tree-equal (stone-counts) '(2 . 3)))))
 
-(ert-deftest sgf-two-stone-capture ()
+(ert-deftest go-two-stone-capture ()
   (with-sgf-display "sgf-files/2-capture.sgf"
-    (sgf-board-next 8) (should (tree-equal (stone-counts) '(6 . 0)))))
+    (go-board-next 8) (should (tree-equal (stone-counts) '(6 . 0)))))
 
-(provide 'sgf-tests)
+(provide 'go-tests)
diff --git a/go-util.el b/go-util.el
index 1b93490..18ae372 100644
--- a/go-util.el
+++ b/go-util.el
@@ -1,4 +1,4 @@
-;;; sgf-util.el --- utility functions for sgf-mode
+;;; go-util.el --- utility functions for GO functions
 
 ;; Copyright (C) 2012 Eric Schulte <address@hidden>
 
@@ -64,4 +64,4 @@
 
 (defun ear-muffs (str) (concat "*" str "*"))
 
-(provide 'sgf-util)
+(provide 'go-util)



reply via email to

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