[Housebot-developers] SF.net SVN: housebot: [470] branches/ld_urbanhafner
Status: Alpha
Brought to you by:
j_house
|
From: <urb...@us...> - 2007-02-17 16:44:17
|
Revision: 470
http://svn.sourceforge.net/housebot/?rev=470&view=rev
Author: urbanhafner
Date: 2007-02-17 08:44:14 -0800 (Sat, 17 Feb 2007)
Log Message:
-----------
Added directory for data structures and added the region class that represents a region as described in Martin M?\195?\188ller's thesis.
Modified Paths:
--------------
branches/ld_urbanhafner/Doxyfile
branches/ld_urbanhafner/configure.ac
branches/ld_urbanhafner/src/Makefile.am
Added Paths:
-----------
branches/ld_urbanhafner/src/datastructures/
branches/ld_urbanhafner/src/datastructures/Makefile.am
branches/ld_urbanhafner/src/datastructures/region.cpp
branches/ld_urbanhafner/src/datastructures/region.hpp
branches/ld_urbanhafner/src/datastructures/test/
branches/ld_urbanhafner/src/datastructures/test/Makefile.am
branches/ld_urbanhafner/src/datastructures/test/region_test.hpp
Property Changed:
----------------
branches/ld_urbanhafner/
Property changes on: branches/ld_urbanhafner
___________________________________________________________________
Name: svn:ignore
- crashes
kgsGtp*
build
housebot.xcodeproj
housebot
doxygen_log.txt
aclocal.m4
autom4te.cache
gmon.out
profile_*.txt
config.status
config.log
configure
Makefile
Makefile.in
depcomp
install-sh
missing
mkinstalldirs
nohup.out
*.sgf
kgslog*
start_housebot
bin
+ Makefile
Makefile.in
autom4te.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
doxygen_log.txt
*.sgf
missing
aclocal.m4
Modified: branches/ld_urbanhafner/Doxyfile
===================================================================
--- branches/ld_urbanhafner/Doxyfile 2007-02-09 09:22:17 UTC (rev 469)
+++ branches/ld_urbanhafner/Doxyfile 2007-02-17 16:44:14 UTC (rev 470)
@@ -228,7 +228,7 @@
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-EXTRACT_ALL = NO
+EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
@@ -406,7 +406,7 @@
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
-QUIET = YES
+QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
@@ -556,7 +556,7 @@
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
-SOURCE_BROWSER = NO
+SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
@@ -603,7 +603,7 @@
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
-ALPHABETICAL_INDEX = NO
+ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
Modified: branches/ld_urbanhafner/configure.ac
===================================================================
--- branches/ld_urbanhafner/configure.ac 2007-02-09 09:22:17 UTC (rev 469)
+++ branches/ld_urbanhafner/configure.ac 2007-02-17 16:44:14 UTC (rev 470)
@@ -42,6 +42,6 @@
AC_SUBST(OPTIONAL_SUBDIRS)
-AC_OUTPUT([Makefile src/Makefile src/brains/Makefile src/sgf/Makefile src/gtp/Makefile src/pattern/Makefile src/phil/Makefile src/brains/test/Makefile src/pattern/test/Makefile])
+AC_OUTPUT([Makefile src/Makefile src/brains/Makefile src/sgf/Makefile src/gtp/Makefile src/pattern/Makefile src/phil/Makefile src/datastructures/Makefile src/brains/test/Makefile src/pattern/test/Makefile src/datastructures/test/Makefile])
Modified: branches/ld_urbanhafner/src/Makefile.am
===================================================================
--- branches/ld_urbanhafner/src/Makefile.am 2007-02-09 09:22:17 UTC (rev 469)
+++ branches/ld_urbanhafner/src/Makefile.am 2007-02-17 16:44:14 UTC (rev 470)
@@ -4,7 +4,7 @@
AM_LDFLAGS = $(BOOST_LDFLAGS)
LIBS = $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB)
-SUBDIRS = brains gtp pattern phil sgf
+SUBDIRS = brains gtp pattern phil sgf datastructures
bin_PROGRAMS = housebot_0_5
# The source files in the current directory
@@ -15,10 +15,11 @@
# For the test framework to work correctly the object files of the test classes
# have to be linked in directly. Using a library doesn't work!
CXXTESTS = ./brains/test/static_ld_test.o ./brains/test/fundamental_test.o \
- ./brains/test/regions_test.o ./pattern/test/pattern_test.o
+ ./brains/test/regions_test.o ./pattern/test/pattern_test.o \
+ ./datastructures/test/region_test.o
LDADD = $(CXXTESTS) ./brains/libbrains.a ./sgf/libsgf.a ./gtp/libgtp.a \
- ./phil/libphil.a ./pattern/libpattern.a
+ ./phil/libphil.a ./pattern/libpattern.a ./datastructures/libds.a
AM_CPPFLAGS = -I../$(CXXTEST) $(HB_CFLAGS)
Property changes on: branches/ld_urbanhafner/src/datastructures
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
.deps
*.o
libds.a
Added: branches/ld_urbanhafner/src/datastructures/Makefile.am
===================================================================
--- branches/ld_urbanhafner/src/datastructures/Makefile.am (rev 0)
+++ branches/ld_urbanhafner/src/datastructures/Makefile.am 2007-02-17 16:44:14 UTC (rev 470)
@@ -0,0 +1,8 @@
+ACLOCAL_AMFLAGS = -I ../../m4
+AM_CXXFLAGS = $(BOOST_CPPFLAGS)
+
+SUBDIRS = test
+noinst_LIBRARIES = libds.a
+libds_a_SOURCES = region.cpp region.hpp
+
+AM_CPPFLAGS = -I .. $(HB_CFLAGS)
Added: branches/ld_urbanhafner/src/datastructures/region.cpp
===================================================================
--- branches/ld_urbanhafner/src/datastructures/region.cpp (rev 0)
+++ branches/ld_urbanhafner/src/datastructures/region.cpp 2007-02-17 16:44:14 UTC (rev 470)
@@ -0,0 +1,72 @@
+/*********************************************************************
+ * Copyright (C) 2007 Urban Hafner *
+ * *
+ * This file is part of housebot. *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301, USA. *
+ *********************************************************************/
+
+#include "datastructures/region.hpp"
+
+namespace ds {
+
+ void region::add_defender_chain(brain::chain* ch) {
+ defender.insert(ch);
+ brain::chain::const_stone_iterator i;
+ for (i = ch->stones_begin(); i != ch->stones_end(); ++i) {
+ add_asa(*i);
+ }
+ }
+
+ void region::remove_defender_chain(brain::chain* ch) {
+ brain::chain::const_stone_iterator i;
+ for (i = ch->stones_begin(); i != ch->stones_end(); ++i) {
+ remove_asa(*i);
+ }
+ defender.erase(ch);
+ }
+
+ void region::add_attacker_chain(brain::chain* ch) {
+ attacker.insert(ch);
+ brain::chain::const_stone_iterator i;
+ for (i = ch->stones_begin(); i != ch->stones_end(); ++i) {
+ positions.insert(*i);
+ }
+ }
+
+ void region::remove_attacker_chain(brain::chain* ch) {
+ attacker.erase(ch);
+ brain::chain::const_stone_iterator i;
+ for (i = ch->stones_begin(); i != ch->stones_end(); ++i) {
+ positions.erase(*i);
+ }
+ }
+
+ void region::merge(const region &r) {
+ HBASSERT(col == r.color());
+ liberties.insert(r.accessible_liberties_begin(),
+ r.accessible_liberties_end());
+ asas.insert(r.asa_begin(), r.asa_end());
+ enclosing.insert(r.enclosing_chains_begin(),
+ r.enclosing_chains_end());
+ defender.insert(r.defender_chains_begin(),
+ r.defender_chains_end());
+ attacker.insert(r.attacker_chains_begin(),
+ r.attacker_chains_end());
+ positions.insert(r.positions_begin(), r.positions_end());
+ }
+
+} /* ds */
\ No newline at end of file
Added: branches/ld_urbanhafner/src/datastructures/region.hpp
===================================================================
--- branches/ld_urbanhafner/src/datastructures/region.hpp (rev 0)
+++ branches/ld_urbanhafner/src/datastructures/region.hpp 2007-02-17 16:44:14 UTC (rev 470)
@@ -0,0 +1,145 @@
+/*********************************************************************
+ * Copyright (C) 2007 Urban Hafner *
+ * *
+ * This file is part of housebot. *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301, USA. *
+ *********************************************************************/
+
+#ifndef _REGION_HPP_
+#define _REGION_HPP_
+
+#include "brains/chains.hpp"
+#include "util.hpp"
+
+namespace ds {
+
+ /// \brief Represents a region in the Muellerian sense.
+ ///
+ /// A region represents a connected group of positions on the board.
+ /// These positions are surrounded by chains of color c (called
+ /// enclosing chains) and may contain both chains of color c (called
+ /// defender chains) and chains of the opponent (called attacker
+ /// chains). The positions that are liberties of the enclosing chains
+ /// are called accessible liberties and interior positions that are
+ /// not occupied by the attacker are called attacker's surroundable
+ /// area (or ASA for short).
+ class region {
+ color_t col;
+ std::set<position> liberties;
+ std::set<position> asas;
+ std::set<position> positions;
+ std::set<brain::chain*> enclosing;
+ std::set<brain::chain*> attacker;
+ std::set<brain::chain*> defender;
+
+ public:
+ /// Iterator type for the accessible liberties.
+ typedef std::set<position>::const_iterator const_liberty_iterator;
+ /// Iterator type for the attacker's surroundable area.
+ typedef std::set<position>::const_iterator const_area_iterator;
+ /// Iterator for the various enumerations of chains.
+ typedef std::set<brain::chain*>::const_iterator const_chain_iterator;
+
+ /// Create a new region of color c.
+ region(color_t c):col(c) {}
+
+ /// The number of accessible liberties of the surrounding chains.
+ int accessible_liberties() const { return liberties.size(); }
+ const_liberty_iterator accessible_liberties_begin() const {
+ return liberties.begin();
+ }
+ const_liberty_iterator accessible_liberties_end() const {
+ return liberties.end();
+ }
+ void add_liberty(const position &p) {
+ liberties.insert(p);
+ positions.insert(p);
+ }
+ void remove_liberty(const position &p) {
+ liberties.erase(p);
+ positions.erase(p);
+ }
+
+ /// The number of attacker's surroundable area positions.
+ int asa() const { return asas.size(); }
+ const_area_iterator asa_begin() const { return asas.begin(); }
+ const_area_iterator asa_end() const { return asas.end(); }
+ void add_asa(const position &p) {
+ asas.insert(p);
+ positions.insert(p);
+ }
+ void remove_asa(const position &p) {
+ asas.erase(p);
+ positions.erase(p);
+ }
+
+ /// The number of enclosing chains.
+ int enclosing_chains() const { return enclosing.size(); }
+ const_chain_iterator enclosing_chains_begin() const {
+ return enclosing.begin();
+ }
+ const_chain_iterator enclosing_chains_end() const {
+ return enclosing.end();
+ }
+ void add_enclosing_chain(brain::chain* ch) { enclosing.insert(ch); }
+ void remove_enclosing_chain(brain::chain* ch) { enclosing.erase(ch); }
+
+ /// The number of defender chains.
+ int defender_chains() const { return defender.size(); }
+ const_chain_iterator defender_chains_begin() const {
+ return defender.begin();
+ }
+ const_chain_iterator defender_chains_end() const {
+ return defender.end();
+ }
+ /// Add chain to the defender chains and all positions to the
+ /// attacker's surroundable area.
+ void add_defender_chain(brain::chain* ch);
+ void remove_defender_chain(brain::chain* ch);
+
+ /// The number of attacker chains.
+ int attacker_chains() const { return attacker.size(); }
+ const_chain_iterator attacker_chains_begin() const {
+ return attacker.begin();
+ }
+ const_chain_iterator attacker_chains_end() const {
+ return attacker.end();
+ }
+ void add_attacker_chain(brain::chain* ch);
+ void remove_attacker_chain(brain::chain* ch);
+
+ int size() const { return positions.size(); }
+ const_area_iterator positions_begin() const {
+ return positions.begin();
+ }
+ const_area_iterator positions_end() const {
+ return positions.end();
+ }
+ const_area_iterator find_position(const position &p) const {
+ return positions.find(p);
+ }
+
+ color_t color() const { return col;}
+ position id() const {return *positions.begin();}
+
+ /// Merges r into the region. It doesn't check whether some chains
+ /// or points appear in several categories.
+ void merge(const region &r);
+ };
+} /* ds */
+
+#endif /* _REGION_HPP_ */
\ No newline at end of file
Property changes on: branches/ld_urbanhafner/src/datastructures/test
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
.deps
*.cpp
libds_test.a
Added: branches/ld_urbanhafner/src/datastructures/test/Makefile.am
===================================================================
--- branches/ld_urbanhafner/src/datastructures/test/Makefile.am (rev 0)
+++ branches/ld_urbanhafner/src/datastructures/test/Makefile.am 2007-02-17 16:44:14 UTC (rev 470)
@@ -0,0 +1,12 @@
+ACLOCAL_AMFLAGS = -I ../../../m4
+AM_CXXFLAGS = $(BOOST_CPPFLAGS)
+
+noinst_LIBRARIES = libds_test.a
+libds_test_a_SOURCES = region_test.cpp
+
+AM_CPPFLAGS = -I.. -I../.. -I../../../$(CXXTEST) $(HB_CFLAGS)
+
+clean:
+ $(RM) *.cpp *.o libds_test.a
+.hpp.cpp:
+ $(PERL) ../../../$(CXXTESTGEN) $(CXXTESTGEN_OPTS) -o $@ $^
Added: branches/ld_urbanhafner/src/datastructures/test/region_test.hpp
===================================================================
--- branches/ld_urbanhafner/src/datastructures/test/region_test.hpp (rev 0)
+++ branches/ld_urbanhafner/src/datastructures/test/region_test.hpp 2007-02-17 16:44:14 UTC (rev 470)
@@ -0,0 +1,182 @@
+/*********************************************************************
+ * Copyright (C) 2007 Urban Hafner *
+ * *
+ * This file is part of housebot. *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301, USA. *
+ *********************************************************************/
+
+#ifndef _REGION_TEST_HPP_
+#define _REGION_TEST_HPP_
+
+#include <cxxtest/TestSuite.h>
+#include "datastructures/region.hpp"
+
+class region_test: public CxxTest::TestSuite {
+public:
+ ds::region *r1;
+ ds::region *r2;
+ brain::chain *ch1;
+ brain::chain *ch2;
+ brain::chain *ch3;
+
+ void setUp() {
+ r1 = new ds::region(black);
+ r2 = new ds::region(black);
+ ch1 = new brain::chain(9);
+ ch1->add_member(position(0,0));
+ ch2 = new brain::chain(9);
+ ch2->add_member(position(2,2));
+ ch3 = new brain::chain(9);
+ ch3->add_member(position(3,3));
+ }
+
+ void tearDown() {
+ delete ch3;
+ delete ch2;
+ delete ch1;
+ delete r2;
+ delete r1;
+ }
+
+ void test_empty_region() {
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ }
+
+ void test_liberties() {
+ r1->add_liberty(position(0,0));
+ TS_ASSERT_EQUALS(r1->size(), 1);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 1);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ r1->remove_liberty(position(0,0));
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ }
+
+ void test_asa() {
+ r1->add_asa(position(0,0));
+ TS_ASSERT_EQUALS(r1->size(), 1);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 1);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ r1->remove_asa(position(0,0));
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ }
+
+ void test_defender_chains() {
+ TS_ASSERT_EQUALS(ch1->size(), 1);
+ r1->add_defender_chain(ch1);
+ TS_ASSERT_EQUALS(r1->size(), 1);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 1);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 1);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ r1->remove_defender_chain(ch1);
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ }
+
+ void test_attacker_chains() {
+ TS_ASSERT_EQUALS(ch1->size(), 1);
+ r1->add_attacker_chain(ch1);
+ TS_ASSERT_EQUALS(r1->size(), 1);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 1);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ r1->remove_attacker_chain(ch1);
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ }
+
+ void test_enclosing_chains() {
+ TS_ASSERT_EQUALS(ch1->size(), 1);
+ r1->add_enclosing_chain(ch1);
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 1);
+ r1->remove_enclosing_chain(ch1);
+ TS_ASSERT_EQUALS(r1->size(), 0);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 0);
+ TS_ASSERT_EQUALS(r1->asa(), 0);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ }
+
+ void test_merge() {
+ r1->add_liberty(position(1,1));
+ r1->add_liberty(position(2,1));
+ r1->add_defender_chain(ch2);
+ TS_ASSERT_EQUALS(r1->size(), 3);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 2);
+ TS_ASSERT_EQUALS(r1->asa(), 1);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 1);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 0);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 0);
+ r2->add_liberty(position(1,1));
+ r2->add_liberty(position(1,2));
+ r2->add_attacker_chain(ch1);
+ r2->add_enclosing_chain(ch3);
+ TS_ASSERT_EQUALS(r2->size(), 3);
+ TS_ASSERT_EQUALS(r2->accessible_liberties(), 2);
+ TS_ASSERT_EQUALS(r2->asa(), 0);
+ TS_ASSERT_EQUALS(r2->defender_chains(), 0);
+ TS_ASSERT_EQUALS(r2->attacker_chains(), 1);
+ TS_ASSERT_EQUALS(r2->enclosing_chains(), 1);
+ r1->merge(*r2);
+ TS_ASSERT_EQUALS(r1->size(), 5);
+ TS_ASSERT_EQUALS(r1->accessible_liberties(), 3);
+ TS_ASSERT_EQUALS(r1->asa(), 1);
+ TS_ASSERT_EQUALS(r1->defender_chains(), 1);
+ TS_ASSERT_EQUALS(r1->attacker_chains(), 1);
+ TS_ASSERT_EQUALS(r1->enclosing_chains(), 1);
+ }
+};
+
+#endif /* _REGION_TEST_HPP_ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|