gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] owl_hotspots() crash


From: Arend Bayer
Subject: [gnugo-devel] owl_hotspots() crash
Date: Tue, 24 Aug 2004 15:10:47 +0200 (CEST)


My changes to the computation of the active area broke the computation
in the case owl_substantial (because it ignored empty board positions in
the goal). This caused a crash later when owl_hotspots() was called
from the aftermath code, and found a OWL_SUBSTANTIAL result in the cache
for a string that had already been captured..

However, the same problem would occur if the persistent cache was just
out of date. Our documentation of purge_persistent_caches() says:
/* Remove persistent cache entries which are no longer compatible with
 * the board. For efficient use of the cache, it's recommended to call
 * this function once per move, before starting the owl reading. It's
 * not required for correct operation though.
 */
This is not true with these assertions. Hence I suggest to deal with
them gracefully as below.

Arend

Index: engine/persistent.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/persistent.c,v
retrieving revision 1.27
diff -u -p -r1.27 persistent.c
--- engine/persistent.c 21 Aug 2004 09:05:04 -0000      1.27
+++ engine/persistent.c 24 Aug 2004 13:04:28 -0000
@@ -1141,9 +1141,8 @@ compute_active_owl_type_area(const char 
    * strings with less than five liberties.
    */
   for (pos = BOARDMIN; pos < BOARDMAX; pos++)
-    if (ON_BOARD(pos))
-      active[pos] |= (goal[pos]
-                     && board[pos] == goal_color);
+    if (ON_BOARD(pos) && goal[pos])
+      active[pos] = 1;
 
   /* Distance four expansion through empty intersections and own stones. */
   for (k = 1; k < 5; k++) {
@@ -1330,7 +1329,8 @@ mark_dragon_hotspot_values(float values[
 {
   int pos;
   int k;
-  ASSERT1(IS_STONE(board[dr]), dr);
+  if (!IS_STONE(board[dr]))
+    return;
   for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
     if (board[pos] != EMPTY)
       continue;
@@ -1430,6 +1430,8 @@ owl_hotspots(float values[BOARDMAX])
       break;
     case OWL_SUBSTANTIAL:
       /* Only consider the liberties of (apos). */
+      if (!IS_STONE(board[entry->apos]))
+       continue;
       liberties = findlib(entry->apos, MAXLIBS, libs);
       for (r = 0; r < liberties; r++)
        values[libs[r]] += contribution;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]