gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Crash in break-in code


From: Arend Bayer
Subject: Re: [gnugo-devel] Crash in break-in code
Date: Sat, 22 Nov 2003 11:22:36 +0100 (CET)

Gunnar wrote:

> GNU Go crashed on NNGS early today. Loading the appended sgf file
> crashes 3.5.2 but not 3.4 or current CVS. The problem is with the
> break-in code. It's a reasonably safe assumption that the problem went
> away with the patch paul_5_2.4, but I don't know whether it was really
> solved or just circumvented.

Only circumvented. The assertion is simply too aggressive, I will
correct this with the patch below in CVS.
I am not sure how often this bug can happen,
        (it needs a successful break-in into white's territory, with
        black to move, around an intersection that still has a little
        black territory, but has two neighbours already belonging to
        white's territory; this is a little illogical, and can happen
        only in special circumstances given the method the territory
        values are computed)
but I'd still suggest to add a 3_4_branch to CVS.
Based on 3.4, it should collect patches avoiding crashes.

Arend

> Assertion failure report and backtrace follow:
>
> ***assertion failure:
> influence.c:1033 - (color == WHITE && q->territory_value[pos] >= 0.0) || 
> (color == BLACK && q->territory_value[pos] <= 0.0) near B13***
>

- remove invalid assertion in influence_erase_territory()


Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.95
diff -u -p -r1.95 influence.c
--- engine/influence.c  12 Aug 2003 21:26:48 -0000      1.95
+++ engine/influence.c  22 Nov 2003 10:24:01 -0000
@@ -1029,8 +1029,6 @@ void
 influence_erase_territory(struct influence_data *q, int pos, int color)
 {
   int k;
-  ASSERT1((color == WHITE && q->territory_value[pos] >= 0.0)
-          || (color == BLACK && q->territory_value[pos] <= 0.0), pos);

   current_influence = q;

@@ -1038,6 +1036,8 @@ influence_erase_territory(struct influen
   influence_mark_non_territory(pos, color);
   for (k = 0; k < 4; k++) {
     if (ON_BOARD(pos + delta[k])) {
+      if ((color == WHITE && q->territory_value[pos + delta[k]] >= 0.0)
+         || (color == BLACK && q->territory_value[pos + delta[k]] <= 0.0))
       q->territory_value[pos + delta[k]] = 0.0;
       influence_mark_non_territory(pos + delta[k], color);
     }
@@ -2184,7 +2184,7 @@ print_influence(const struct influence_d
     print_influence_areas(q);
   }
   if (printmoyo & PRINTMOYO_VALUE_TERRITORY) {
-    fprintf(stderr, "territory (%s)", info_string);
+    fprintf(stderr, "territory (%s)\n", info_string);
     print_numeric_influence(q, q->territory_value, "%5.2f", 5, 1, 0);
   }
 }




reply via email to

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