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

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

[elpa] 111/255: uniform gtp prefix


From: Eric Schulte
Subject: [elpa] 111/255: uniform gtp prefix
Date: Sun, 16 Mar 2014 01:02:30 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit ce19ad7a624f8a3175033e8004c048647cc3ae4c
Author: Eric Schulte <address@hidden>
Date:   Sun May 27 15:47:08 2012 -0600

    uniform gtp prefix
---
 go-board.el |    4 ++--
 go-gnugo.el |    2 +-
 go-tests.el |   20 ++++++++++----------
 gtp.el      |   26 +++++++++++++-------------
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/go-board.el b/go-board.el
index cbfd99f..ba5b072 100644
--- a/go-board.el
+++ b/go-board.el
@@ -264,12 +264,12 @@
 (defun go-board-act-move (&optional pos)
   (interactive)
   (let* ((color (case *turn* (:B "black") (:W "white")))
-         (pos (or pos (cons (go-gtp-char-to-num
+         (pos (or pos (cons (gtp-char-to-num
                              (aref (downcase
                                     (org-icompleting-read
                                      (format "[%s] X pos: " color)
                                      (mapcar #'string
-                                             (mapcar #'go-gtp-num-to-char
+                                             (mapcar #'gtp-num-to-char
                                                      (range 1 *size*)))))
                                    0))
                             (1- (string-to-number
diff --git a/go-gnugo.el b/go-gnugo.el
index 738a45b..a04f8c3 100644
--- a/go-gnugo.el
+++ b/go-gnugo.el
@@ -31,7 +31,7 @@
 
 ;;; CODE:
 (require 'go-util)
-(require 'go-gtp)
+(require 'gtp)
 (require 'comint)
 
 (defun go-gnugo-gtp-commands ()
diff --git a/go-tests.el b/go-tests.el
index fa9d7ec..159d9c3 100644
--- a/go-tests.el
+++ b/go-tests.el
@@ -29,7 +29,7 @@
 (require 'go-util)
 (require 'sgf2el)
 (require 'go-board)
-(require 'go-gtp)
+(require 'gtp)
 (require 'go-gnugo)
 (require 'sgf)
 (require 'ert)
@@ -153,15 +153,15 @@
 
 
 ;;; GTP and gnugo tests
-(ert-deftest go-test-go-gtp-char-to-gtp ()
-  (should (= 0  (go-gtp-char-to-num ?A)))
-  (should (= 7  (go-gtp-char-to-num ?H)))
-  (should (= 8  (go-gtp-char-to-num ?J)))
-  (should (= 18 (go-gtp-char-to-num ?T)))
-  (should (= 0  (go-gtp-char-to-num ?a)))
-  (should (= 7  (go-gtp-char-to-num ?h)))
-  (should (= 8  (go-gtp-char-to-num ?j)))
-  (should (= 18 (go-gtp-char-to-num ?t))))
+(ert-deftest go-test-gtp-char-to-gtp ()
+  (should (= 0  (gtp-char-to-num ?A)))
+  (should (= 7  (gtp-char-to-num ?H)))
+  (should (= 8  (gtp-char-to-num ?J)))
+  (should (= 18 (gtp-char-to-num ?T)))
+  (should (= 0  (gtp-char-to-num ?a)))
+  (should (= 7  (gtp-char-to-num ?h)))
+  (should (= 8  (gtp-char-to-num ?j)))
+  (should (= 18 (gtp-char-to-num ?t))))
 
 (defmacro with-gnugo (&rest body)
   `(let (*gnugo*)
diff --git a/gtp.el b/gtp.el
index d236c2a..b9d8764 100644
--- a/gtp.el
+++ b/gtp.el
@@ -1,4 +1,4 @@
-;;; go-gtp.el --- GTP backend for go-trans
+;;; gtp.el --- GTP GO backend
 
 ;; Copyright (C) 2008 2012 Eric Schulte <address@hidden>
 
@@ -35,14 +35,14 @@
 (require 'go-util)
 (require 'go-trans)
 
-(defun go-gtp-expand-color (turn)
+(defun gtp-expand-color (turn)
   (case turn
     (:B "black")
     (:W "white")
     (t (error "gtp: unknown turn %S" turn))))
 
-(defun go-gtp-char-to-num (char)
-  (flet ((err () (error "go-gtp: invalid char %s" char)))
+(defun gtp-char-to-num (char)
+  (flet ((err () (error "gtp: invalid char %s" char)))
     (cond
      ((< char ?A)  (err))
      ((< char ?I)  (- char ?A))
@@ -52,18 +52,18 @@
      ((<= char ?t) (1- (- char ?a)))
      (t (err)))))
 
-(defun go-gtp-num-to-char (num)
-  (flet ((err () (error "go: invalid num %s" num)))
+(defun gtp-num-to-char (num)
+  (flet ((err () (error "gtp: invalid num %s" num)))
     (cond
      ((< num 1) (err))
      ((< num 9) (+ ?A (1- num)))
      (t         (+ ?A num)))))
 
 (defun go-pos-to-gtp (pos)
-  (format "%c%d" (go-gtp-num-to-char (1+ (car pos))) (1+ (cdr pos))))
+  (format "%c%d" (gtp-num-to-char (1+ (car pos))) (1+ (cdr pos))))
 
-(defun go-gtp-to-pos (color gtp)
-  (cons color (cons :pos (cons (go-gtp-char-to-num (aref gtp 0))
+(defun gtp-to-pos (color gtp)
+  (cons color (cons :pos (cons (gtp-char-to-num (aref gtp 0))
                                (1- (parse-integer (substring gtp 1)))))))
 
 (defun go-to-gtp-command (element)
@@ -98,7 +98,7 @@
 
 (defmethod go-move ((gtp gtp))
   (let ((color (go-color gtp)))
-    (go-gtp-to-pos color
+    (gtp-to-pos color
                    (case color
                      (:B (gtp-command gtp "genmove_black"))
                      (:W (gtp-command gtp "genmove_white"))))))
@@ -136,11 +136,11 @@
 (defmethod go-undo ((gtp gtp)) (gtp-command gtp "undo"))
 
 (defmethod go-pass ((gtp gtp))
-  (gtp-command gtp (format "%s pass" (go-gtp-expand-color (go-color gtp)))))
+  (gtp-command gtp (format "%s pass" (gtp-expand-color (go-color gtp)))))
 
 (defmethod go-resign ((gtp gtp))
-  (gtp-command gtp (format "%s resign" (go-gtp-expand-color (go-color gtp)))))
+  (gtp-command gtp (format "%s resign" (gtp-expand-color (go-color gtp)))))
 
 (defmethod go-reset ((gtp gtp)) (gtp-command gtp "clear_board"))
 
-(provide 'go-gtp)
+(provide 'gtp)



reply via email to

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