[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] Bug fix
From: |
Daniel Bump |
Subject: |
[gnugo-devel] Bug fix |
Date: |
Wed, 24 Oct 2001 20:22:54 -0700 |
Earlier today I posted a game in which a colossal blunder occurs at move 56.
http://mail.gnu.org/pipermail/gnugo-devel/2001-October/000272.html
It turns out that the reason is a familiar one. At move 56 there
are two moves that defend the worm at H6. One, at J7 only produces
ko. Unfortunately estimate_territorial_value doesn't know the difference.
Luckily one that recent changes of Gunnar's makes easy to fix.
Since all move reasons are now cached in the struct worm_data
array, it is easy to go through and deprecate attack and
defend move reasons that produce KO_A or KO_B.
I won't put this in the CVS until I've run the regressions and
given Gunnar (and anyone else) a chance to comment.
For 1D debugging I recommend adding this to your .gdbinit file:
define pascii
set gprintf("%o%m\n",($arg0)/20 -1, ($arg0)%20 -1)
end
Then
(gdb) pascii pos
will tell you where pos is on the board.
Dan
===================================================================
RCS file: /cvsroot/gnugo/gnugo/ChangeLog,v
retrieving revision 1.62
diff -u -r1.62 ChangeLog
--- ChangeLog 2001/10/25 02:46:23 1.62
+++ ChangeLog 2001/10/25 03:15:10
@@ -2,6 +2,7 @@
-- ChangeLog
-------------------------------------------------------------------------
+- estimate_territorial_value deprecates attack/defend reasons which only get ko
- new reorientation test suites
- remove rot* subdirs from EXTRA_DIST
- bugfix in score.c (typo from 1D conversion)
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.37
diff -u -r1.37 liberty.h
--- engine/liberty.h 2001/10/18 19:17:19 1.37
+++ engine/liberty.h 2001/10/25 03:15:24
@@ -559,7 +559,8 @@
/* worm which can be captured easily. */
int cutstone; /* 1=potential cutting stone; 2=cutting stone */
int cutstone2; /* Number of potential cuts involving the worm. */
- int genus; /* number of connected components of the complement, less
one */
+ int genus; /* number of connected components of the complement, */
+ /* less one */
int inessential; /* 1=inessential worm */
int invincible; /* 1=strongly unconditionally non-capturable */
int unconditional_status; /* ALIVE, DEAD, WHITE_BORDER, BLACK_BORDER,
UNKNOWN */
Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.30
diff -u -r1.30 move_reasons.c
--- engine/move_reasons.c 2001/10/18 19:17:19 1.30
+++ engine/move_reasons.c 2001/10/25 03:15:53
@@ -2082,6 +2082,19 @@
this_value = 2 * worm[aa].effective_size;
+ /* Reduce the value if it only works with ko */
+ {
+ int u;
+ for (u = 0; u < MAX_TACTICAL_POINTS; u++)
+ if (worm[aa].attack_points[u] == pos) {
+ if (worm[aa].attack_codes[u] == KO_A)
+ this_value *= .9;
+ else if (worm[aa].attack_codes[u] == KO_B)
+ this_value *= .8;
+ break;
+ }
+ }
+
/* If the stones are dead, there is only a secondary value in
* capturing them tactically as well.
*/
@@ -2126,6 +2139,19 @@
}
this_value = 2 * worm[aa].effective_size;
+
+ /* Reduce the value if it only works with ko */
+ {
+ int u;
+ for (u = 0; u < MAX_TACTICAL_POINTS; u++)
+ if (worm[aa].defense_points[u] == pos) {
+ if (worm[aa].defend_codes[u] == KO_A)
+ this_value *= .9;
+ else if (worm[aa].defend_codes[u] == KO_B)
+ this_value *= .8;
+ break;
+ }
+ }
/* If the stones are dead, we use the convention that
* defending them has a strategical value rather than
Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.19
diff -u -r1.19 worm.c
--- engine/worm.c 2001/10/18 19:17:19 1.19
+++ engine/worm.c 2001/10/25 03:16:15
@@ -1947,6 +1947,7 @@
void
report_worm(int m, int n)
{
+ int k;
int pos = POS(m, n);
if (board[pos] == EMPTY) {
gprintf("There is no worm at %1m\n", pos);
@@ -1964,34 +1965,37 @@
worm[pos].liberties3,
worm[pos].liberties4);
- /* FIXME: List all attack points. */
- if (worm[pos].attack_points[0] != NO_MOVE)
- gprintf("attack point %1m, ", worm[pos].attack_points[0]);
- else
- gprintf("no attack point, ");
-
- if (worm[pos].attack_codes[0] == WIN)
- gprintf("attack code WIN\n");
- else if (worm[pos].attack_codes[0] == KO_A)
- gprintf("attack code KO_A\n");
- else if (worm[pos].attack_codes[0] == KO_B)
- gprintf("attack code KO_B\n");
-
- /* FIXME: List all defense points. */
- if (worm[pos].defense_points[0] != NO_MOVE)
- gprintf("defense point %1m, ", worm[pos].defense_points[0]);
- else
- gprintf("no defense point, ");
+ for (k = 0; k < MAX_TACTICAL_POINTS; k++) {
+ if (worm[pos].attack_points[k] == NO_MOVE) {
+ if (k == 0)
+ gprintf("no attack point, ");
+ break;
+ }
+ gprintf("attack point %1m, ", worm[pos].attack_points[k]);
+ if (worm[pos].attack_codes[k] == WIN)
+ gprintf("attack code WIN\n");
+ else if (worm[pos].attack_codes[k] == KO_A)
+ gprintf("attack code KO_A\n");
+ else if (worm[pos].attack_codes[k] == KO_B)
+ gprintf("attack code KO_B\n");
+ }
- if (worm[pos].defend_codes[0] == WIN)
- gprintf("defend code WIN\n");
- else if (worm[pos].defend_codes[0] == KO_A)
- gprintf("defend code KO_A\n");
- else if (worm[pos].defend_codes[0] == KO_B)
- gprintf("defend code KO_B\n");
+ for (k = 0; k < MAX_TACTICAL_POINTS; k++) {
+ if (worm[pos].defense_points[k] == NO_MOVE) {
+ if (k == 0)
+ gprintf("no defense point, ");
+ break;
+ }
+ gprintf("defense point %1m, ", worm[pos].defense_points[k]);
+ if (worm[pos].defend_codes[k] == WIN)
+ gprintf("defend code WIN\n");
+ else if (worm[pos].defend_codes[k] == KO_A)
+ gprintf("defend code KO_A\n");
+ else if (worm[pos].defend_codes[k] == KO_B)
+ gprintf("defend code KO_B\n");
+ }
/* FIXME: List all attack and defense threat points. */
-
if (worm[pos].lunch != NO_MOVE)
gprintf("lunch at %1m\n", worm[pos].lunch);
- [gnugo-devel] Bug fix,
Daniel Bump <=