[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 31/255: a test to protect against unwanted state changes
From: |
Eric Schulte |
Subject: |
[elpa] 31/255: a test to protect against unwanted state changes |
Date: |
Sun, 16 Mar 2014 01:02:13 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit 93ba892c4899389721f4d74e2d44c438c4ac41ab
Author: Eric Schulte <address@hidden>
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))))
- [elpa] 09/255: parsing more complex trees, (continued)
- [elpa] 09/255: parsing more complex trees, Eric Schulte, 2014/03/15
- [elpa] 19/255: moving games/ -> sgf-files/, Eric Schulte, 2014/03/15
- [elpa] 10/255: helper functions, Eric Schulte, 2014/03/15
- [elpa] 24/255: right and left implemented but buggy, Eric Schulte, 2014/03/15
- [elpa] 23/255: more complex but more intuitive and useful `range', Eric Schulte, 2014/03/15
- [elpa] 21/255: display sgf file as a go board in a buffer, Eric Schulte, 2014/03/15
- [elpa] 25/255: right and left are mainly working, Eric Schulte, 2014/03/15
- [elpa] 29/255: q now quits a sgf display buffer, Eric Schulte, 2014/03/15
- [elpa] 28/255: adding a major mode for board navigation keys, Eric Schulte, 2014/03/15
- [elpa] 27/255: implementation notes, Eric Schulte, 2014/03/15
- [elpa] 31/255: a test to protect against unwanted state changes,
Eric Schulte <=
- [elpa] 33/255: removing dead pieces after moves, Eric Schulte, 2014/03/15
- [elpa] 35/255: compiled and caught some minor issues, Eric Schulte, 2014/03/15
- [elpa] 32/255: consolidating utility functions, Eric Schulte, 2014/03/15
- [elpa] 30/255: saving the board configuration with each sgf step, Eric Schulte, 2014/03/15
- [elpa] 18/255: applying moves to a board, Eric Schulte, 2014/03/15
- [elpa] 37/255: remove debug printf, Eric Schulte, 2014/03/15
- [elpa] 34/255: beginning to stub out tests for dead stone removal, Eric Schulte, 2014/03/15
- [elpa] 38/255: more capture tests, failing multistone captures, Eric Schulte, 2014/03/15
- [elpa] 36/255: passing all tests (at least it did this once), Eric Schulte, 2014/03/15
- [elpa] 26/255: improvements, considering labels and moves, Eric Schulte, 2014/03/15