gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] a small patch


From: Nando
Subject: [gnugo-devel] a small patch
Date: Sun, 29 Sep 2002 16:54:56 +0200

Hi,

The following patch solves these problems:

---- File [atari_atari.tst]
16 PASSED
---- File [trevorc.tst]
1540 PASSED


and fixes an array bounds violation bug.

/nando


Index: engine/combination.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v
retrieving revision 1.36
diff -u -r1.36 combination.c
--- engine/combination.c        26 Sep 2002 20:28:09 -0000      1.36
+++ engine/combination.c        29 Sep 2002 14:24:29 -0000
@@ -1183,12 +1183,20 @@
     queue[queue_end++] = apos;
   }

+#if 0
+  /* Disabled for now, since it does nothing but break atari_atari:16
+   * and trevorc:1540. It could be reactivated when the rest of the
+   * function would be modified in order to garanty that a forbidden
+   * move is strictly equivalent to a played move in terms of goal
+   * mapping. I doubt it would be anything worth though...
+   */
   for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
     if (ON_BOARD(pos) && forbidden[pos]) {
       dists[pos] = 1;
       queue[queue_end++] = pos;
     }
   }
+#endif

   if (queue_end == 0)
     return 0;
@@ -1223,6 +1231,8 @@
      */
     for (k = 0; k < 4; k++) {
       int pos2 = pos + delta[k];
+      if (!ON_BOARD(pos2))
+       continue;
       if ((board[pos] == other || pos == apos) && board[pos2] == EMPTY) {
         ENQUEUE(pos2, dists[pos] + 1);
       }




reply via email to

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