[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] Revision of inessentiality.
From: |
Gunnar Farneback |
Subject: |
[gnugo-devel] Revision of inessentiality. |
Date: |
Mon, 18 Nov 2002 18:26:01 +0100 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode) |
Near the end make_dragons(), critical worms are revised to inessential
under certain circumstances. This patch revises that code for reasons
which are best explained by the comments in the patch.
I don't know what this patch does to the regressions but I'd say it's
clearly correct and important in order to avoid abandoning monkey
jumps.
/Gunnar
Index: engine/dragon.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/dragon.c,v
retrieving revision 1.87
diff -u -r1.87 dragon.c
--- engine/dragon.c 14 Oct 2002 15:41:07 -0000 1.87
+++ engine/dragon.c 15 Nov 2002 13:34:21 -0000
@@ -618,7 +618,45 @@
/* Revise essentiality of critical worms. Specifically, a critical
* worm which is adjacent to no enemy dragon with status
* better than DEAD, is considered INESSENTIAL.
+ *
+ * A typical case of this is
+ *
+ * |.XXXX
+ * |.OO.X
+ * |X.O.X
+ * |.OO.X
+ * +-----
+ *
+ * However, to be able to deal with the position
+ *
+ * |.XXXX
+ * |.OOOO
+ * |..O.O
+ * |X.OOO
+ * |..O.O
+ * +-----
+ *
+ * we need to extend "adjacent" to "adjacent or shares a liberty",
+ * which is why we use extended_chainlinks() rather than
+ * chainlinks().
+ *
+ * Finally, if the position above is slightly modified to
+ *
+ * |.XXXXX
+ * |.OOOOO
+ * |...O.O
+ * |X..OOO
+ * |...O.O
+ * +------
+ *
+ * we have a position where the critical X stone doesn't share a
+ * liberty with any string at all. Thus the revised rule is:
+ *
+ * A critical worm which is adjacent to or share a liberty with at
+ * least one dead opponent dragon and no opponent dragon which is
+ * not dead, is considered inessential.
*/
+
for (str = BOARDMIN; str < BOARDMAX; str++)
if (ON_BOARD(str)) {
if (is_worm_origin(str, str)
@@ -630,14 +668,14 @@
int r;
int essential = 0;
- neighbors = chainlinks(str, adjs);
+ neighbors = extended_chainlinks(str, adjs, 0);
for (r = 0; r < neighbors; r++)
if (dragon[adjs[r]].status != DEAD) {
essential = 1;
break;
}
- if (!essential) {
+ if (!essential && neighbors > 0) {
DEBUG(DEBUG_WORMS, "Worm %1m revised to be inessential.\n", str);
worm[str].inessential = 1;
propagate_worm(str);
- [gnugo-devel] Revision of inessentiality.,
Gunnar Farneback <=