gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] more bugfixes


From: Arend Bayer
Subject: Re: [gnugo-devel] more bugfixes
Date: Sun, 10 Nov 2002 23:23:06 +0100 (CET)

Evan wrote:

> On Sun, 10 Nov 2002, Gunnar Farneback wrote:
>
> > Evan wrote:
> > > - findlib() was returning a more liberties than it had copied if liberties
> > > > maxlib.  This would cause a crash in some cases (namely, my current work
> > > with attack5/defend5.  I can send in the version that has problems if
> > > desired).
> >
> > That is not a bug, it's just a failure to read the documentation.
>
> So it is.  The bug is in the combination code.  Patch below.

This is not a bug in the combination code either. In the context below,
(str) is always an attackable string, hence it can have at most 4
liberties.

Of course this assumption is no longer valid with attack5. _Then_ adjust
the code below. (Btw, there might be numerous other places with similar
assumptions in the code, so you should be a bit careful about that.)

Arend

> Index: engine/combination.c
> ===================================================================
> RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v
> retrieving revision 1.39
> diff -u -r1.39 combination.c
> --- engine/combination.c      2 Nov 2002 15:33:43 -0000       1.39
> +++ engine/combination.c      10 Nov 2002 14:12:34 -0000
> @@ -1018,7 +1018,7 @@
>    int move;
>    int k;
>    int liberties;
> -  int libs[4];
> +  int libs[MAXLIBS];
>    int neighbors;
>    int adjs[MAXCHAIN];
>    int mx[BOARDMAX];
> @@ -1047,7 +1047,7 @@
>      mx[move] = 1;
>
>      /* Consider all moves to attack a neighbor or to play on a liberty. */
> -    liberties = findlib(str, 4, libs);
> +    liberties = findlib(str, MAXLIBS, libs);
>      for (k = 0; k < liberties; k++) {
>        if (!mx[libs[k]]
>         && trymove(libs[k], board[str], "aa_defend-A", str,





reply via email to

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