eschulte pushed a commit to branch go
in repository elpa.
commit 93ba892c4899389721f4d74e2d44c438c4ac41ab
Author: Eric Schulte <[email protected]>
Date: Thu May 17 09:45:41 2012 -0400
a test to protect against unwanted state changes
---
sgf.el | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/sgf.el b/sgf.el
index 98fd973..e40503f 100644
--- a/sgf.el
+++ b/sgf.el
@@ -371,6 +371,7 @@
(length *board*)))
(clear-labels *board*)
(apply-moves *board* (sgf-ref *sgf* *index*))
+ (remove-dead *board*)
(push (cons :pieces (board-to-pieces *board*))
(sgf-ref *sgf* *index*))))
(update-display)))
@@ -404,6 +405,24 @@
(unless (member (aref board point) '(:b :w))
(setf (aref board point) nil)))))
+(defun any (func seq)
+ (reduce ))
+
+(defun neighbors (board piece)
+ )
+
+(defun alive-p (board piece)
+ (let ((val (aref board piece))
+ (neighbors (neighbors board piece)))
+ (or (any #'null neighbors)
+ (any #'alive-p (remove-if-not (lambda (n) (equal (aref board piece)
val))
+ neighbors)))))
+
+(defun remove-dead (board)
+ (dotimes (n (length board) board)
+ (let ((val (aref board n)))
+ (when (and val )))))
+
;;; Display mode
(defvar sgf-mode-map
@@ -540,3 +559,12 @@
(should *sgf*)
(should *index*))
(should (kill-buffer buffer))))
+
+(ert-deftest sgf-independent-points-properties ()
+ (let* ((joseki (car (read-from-file "sgf-files/3-4-joseki.sgf")))
+ (buffer (display-sgf joseki))
+ (points-length (length (assoc :points (sgf-ref joseki '(0))))))
+ (with-current-buffer buffer
+ (right 4)
+ (should (= points-length (length (assoc :points (sgf-ref joseki
'(0)))))))
+ (should (kill-buffer buffer))))