gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] important bugfix


From: Gunnar Farneback
Subject: [gnugo-devel] important bugfix
Date: Wed, 17 Oct 2001 21:53:23 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

GNU Go 3.1.10 and current CVS crashes when generating a move for the
last position in the game regression/games/juka1.sgf in CVS. This is
fixed by the patch below.

/Gunnar

Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.28
diff -u -r1.28 move_reasons.c
--- engine/move_reasons.c       2001/10/16 19:53:01     1.28
+++ engine/move_reasons.c       2001/10/17 19:40:41
@@ -2209,7 +2209,15 @@
        int adjustment_up = 0;
        int adjustment_down = 0;
        int s;
-       int num_adj = chainlinks(aa, adjs);
+       int num_adj;
+
+       /* In rare cases it may happen that the trymove() above
+         * actually removed the string at aa.
+        */
+       if (board[aa] == EMPTY)
+         num_adj = 0;
+       else
+         num_adj = chainlinks(aa, adjs);
 
        for (s = 0; s < num_adj; s++) {
          int adj = adjs[s];
Index: engine/worm.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/worm.c,v
retrieving revision 1.17
diff -u -r1.17 worm.c
--- engine/worm.c       2001/10/12 20:35:26     1.17
+++ engine/worm.c       2001/10/17 19:40:49
@@ -1030,7 +1030,11 @@
              bb = worm[adjs[k]].defense_points[r];
              if (trymove(bb, other, "threaten attack", pos,
                          EMPTY, NO_MOVE)) {
-               int acode = attack(pos, NULL);
+               int acode;
+               if (board[pos] == EMPTY)
+                 acode = WIN;
+               else
+                 acode = attack(pos, NULL);
                if (acode != 0)
                  change_attack_threat(pos, bb, acode);
                popgo();



reply via email to

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