[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] #16: owl cuts and escape
From: |
Arend Bayer |
Subject: |
[gnugo-devel] #16: owl cuts and escape |
Date: |
Mon, 12 Sep 2005 22:09:50 +0200 (CEST) |
This patch adresses ticket #16, brought up by Gunnar:
http://83.250.33.151/gnugo/trac.cgi/ticket/16.
It does this by introducing a new array cumulative_goal in the owl data,
that keeps track of all positions where there has been a goal stone some
time earlier. These positions are not allowed to add to the dragon's escape
measure (although they still have an escape value for pattern purposes).
strategy2:73 FAIL E7 [F7|R17|P15]
nicklas1:1901 FAIL B3 [B7]
auto02:7 FAIL 0 [1 (S15|R15)]
Total nodes: 1700237856 3235170 13302899
(+0.01% +0.4% +0.01%)
All 3 FAILs are clear improvements, as GNU Go earlier completely
misjudge to be "escaped" (towards stones that were earlier part of the
goal dragon).
Arend
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.231
diff -u -p -r1.231 owl.c
--- engine/owl.c 12 Jun 2005 09:34:14 -0000 1.231
+++ engine/owl.c 12 Sep 2005 19:10:53 -0000
@@ -69,6 +69,8 @@
struct local_owl_data {
char goal[BOARDMAX];
char boundary[BOARDMAX];
+ /* Same as goal, except never anything is removed from it. */
+ char cumulative_goal[BOARDMAX];
/* FIXME: neighbors[] and escape_values[] are never recomputed.
* Consider moving these arrays from stack to a static or
@@ -4417,6 +4419,7 @@ owl_mark_dragon(int apos, int bpos, stru
}
}
+ memcpy(owl->cumulative_goal, owl->goal, sizeof(owl->goal));
owl->color = color;
owl_mark_boundary(owl);
}
@@ -4600,6 +4603,7 @@ owl_update_goal(int pos, int same_dragon
if (0)
TRACE("Added %1m to goal.\n", stones[k]);
owl->goal[stones[k]] = 2;
+ owl->cumulative_goal[stones[k]] = 1;
}
}
@@ -4611,8 +4615,10 @@ owl_update_goal(int pos, int same_dragon
int k;
adj = chainlinks(lunch, adjs);
for (k = 0; k < adj; k++)
- if (!owl->goal[adjs[k]])
+ if (!owl->goal[adjs[k]]) {
mark_string(adjs[k], owl->goal, 2);
+ mark_string(adjs[k], owl->cumulative_goal, 2);
+ }
}
if (1 && verbose)
@@ -5978,6 +5984,7 @@ owl_substantial(int str)
/* 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.
*/
+ memcpy(owl->cumulative_goal, owl->goal, BOARDMAX);
compute_owl_escape_values(owl);
owl_mark_boundary(owl);
owl->lunches_are_current = 0;
@@ -6492,7 +6499,13 @@ owl_strong_dragon(int pos)
static int
owl_escape_route(struct local_owl_data *owl)
{
- return dragon_escape(owl->goal, owl->color, owl->escape_values);
+ char modified_escape[BOARDMAX];
+ int pos;
+ memcpy(modified_escape, owl->escape_values, sizeof(modified_escape));
+ for (pos = BOARDMIN; pos < BOARDMAX; pos++)
+ if (ON_BOARD(pos) && owl->cumulative_goal[pos])
+ modified_escape[pos] = 0;
+ return dragon_escape(owl->goal, owl->color, modified_escape);
}
@@ -6563,6 +6576,8 @@ do_push_owl(struct local_owl_data **owl)
VALGRIND_MAKE_WRITABLE(new_owl, sizeof(struct local_owl_data));
/* Copy the owl data. */
memcpy(new_owl->goal, (*owl)->goal, sizeof(new_owl->goal));
+ memcpy(new_owl->cumulative_goal, (*owl)->cumulative_goal,
+ sizeof(new_owl->cumulative_goal));
memcpy(new_owl->boundary, (*owl)->boundary, sizeof(new_owl->boundary));
memcpy(new_owl->neighbors, (*owl)->neighbors, sizeof(new_owl->neighbors));
memcpy(new_owl->escape_values, (*owl)->escape_values,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] #16: owl cuts and escape,
Arend Bayer <=