[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] owl goal dragon gets cut
From: |
Gunnar Farnebäck |
Subject: |
Re: [gnugo-devel] owl goal dragon gets cut |
Date: |
Tue, 24 Aug 2004 05:34:15 +0200 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI) |
Arend wrote:
> Say there were two strings, and they can be cut now. Then we compute the
> distance map from both strings (using the readconnect code), and build two
> components of the goal by assigning each stone to the string to which it is
> closer. The new goal is then the bigger of the two components.
It should probably not only take size into account but also where the
stones of the original dragon are.
> I would very much appreciate comments/ideas on this approach.
The trickiest part is of course to do this with reasonable
performance. Do you know how the node counters compare to CVS?
For what it's worth I made a failed, and not very ambitious, try to
solve this problem about a year ago. I don't remember whether the
results or the performance, or maybe both, was the problem. In case
that it can give some kind of inspiration, I include it below.
/Gunnar
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.178
diff -u -r1.178 owl.c
--- engine/owl.c 10 Aug 2003 17:56:50 -0000 1.178
+++ engine/owl.c 9 Sep 2003 05:47:43 -0000
@@ -65,6 +65,7 @@
struct local_owl_data {
char goal[BOARDMAX];
+ int heart;
char boundary[BOARDMAX];
/* FIXME: escape_values[] are never recomputed. Consider moving this array
@@ -3634,6 +3635,7 @@
}
owl->color = color;
+ owl->heart = apos;
owl_mark_boundary(owl);
}
@@ -3824,6 +3826,22 @@
&& owl->boundary[pos2] < boundary_mark)
mark_string(pos2, owl->boundary, boundary_mark);
}
+
+ for (k = 0; k < 12; k++) {
+ int pos2 = pos + delta[k % 8];
+ if (k >= 8) {
+ if (!ON_BOARD(pos2))
+ continue;
+ else
+ pos2 += delta[k % 8];
+ }
+
+ if (board[pos2] == OTHER_COLOR(board[pos])
+ && owl->goal[pos2] > 0
+ && disconnect(pos2, owl->heart, NULL) == WIN)
+ mark_string(pos2, owl->goal, (char) 0);
+ }
+
}
/* Lists the goal array. For use in GDB:
@@ -4910,6 +4928,8 @@
}
}
}
+ owl->heart = libs[0];
+
/* FIXME: We would want to use init_owl() here too, but it doesn't
* fit very well with the construction of the goal array above.
*/
@@ -5172,7 +5192,7 @@
for (m = 0; m < board_size; m++) {
for (n = 0; n < board_size; n++) {
pos = POS(m, n);
- if (dragon[pos].color == owl->color) {
+ if (dragon[pos].color == owl->color && !owl->goal[pos]) {
if (dragon[pos].crude_status == ALIVE)
owl->escape_values[pos] = 6;
else if (dragon[pos].crude_status == UNKNOWN
@@ -5419,6 +5439,7 @@
/* Copy the owl data. */
memcpy(new_owl->goal, (*owl)->goal, sizeof(new_owl->goal));
+ new_owl->heart = (*owl)->heart;
memcpy(new_owl->boundary, (*owl)->boundary, sizeof(new_owl->boundary));
memcpy(new_owl->escape_values, (*owl)->escape_values,
sizeof(new_owl->escape_values));
leak? Re: [gnugo-devel] owl goal dragon gets cut, Douglas Ridgway, 2004/08/30