gnugo-devel
[Top][All Lists]
Advanced

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

Re: arend_1_30.1: Re: [gnugo-devel] Influence crash


From: Daniel Bump
Subject: Re: arend_1_30.1: Re: [gnugo-devel] Influence crash
Date: Wed, 27 Mar 2002 14:34:57 -0800

> On Wed, 27 Mar 2002, Gunnar Farneback wrote:
> 
> > If I understand this correctly, nothing terribly bad would happen if
> > we discarded the last few intrusions when the array becomes full. For
> > the stable release 3.2 it might be better to just silently discard
> > than to crash with an assertion failure.
> Yes, you are right. Maybe we should have a compiler switch "GG_FULL_ASSERT"
> that we turn on occasionally? It would also be useful e.g. for Trevor's
> DRAGON2 range check, and might get used for lots of other range checks
> that cost performance.

I put up a patch that stops this crash at:

http://www.gnu.org/software/gnugo/patches/influence_1_30.1

I'll add it to the CVS tomorrow if Arend and Gunnar approve it.

Dan


Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.45
diff -u -r1.45 influence.c
--- engine/influence.c  26 Mar 2002 21:32:59 -0000      1.45
+++ engine/influence.c  27 Mar 2002 22:03:28 -0000
@@ -493,7 +493,10 @@
                        float strength, float attenuation,
                        struct influence_data *q)
 {
-  gg_assert(q->intrusion_counter < MAX_INTRUSIONS);
+  if (q->intrusion_counter >= MAX_INTRUSIONS) {
+    DEBUG(DEBUG_INFLUENCE, "intrusion list exhausted\n");
+    return;
+  }
   q->intrusions[q->intrusion_counter].source_pos = source_pos;
   q->intrusions[q->intrusion_counter].strength_pos = strength_pos;
   q->intrusions[q->intrusion_counter].strength = strength;
Index: engine/influence.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.h,v
retrieving revision 1.9
diff -u -r1.9 influence.h
--- engine/influence.h  4 Mar 2002 06:49:08 -0000       1.9
+++ engine/influence.h  27 Mar 2002 22:03:28 -0000
@@ -74,7 +74,7 @@
  */ 
 #define MAX_REGIONS (3*MAX_BOARD*MAX_BOARD + 1)
 
-#define MAX_INTRUSIONS (MAX_BOARD * MAX_BOARD)
+#define MAX_INTRUSIONS (2 * MAX_BOARD * MAX_BOARD)
 
 struct intrusion_data
 {



reply via email to

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