Currently the fuseki code requires too large open regions to be useful
on tiny boards. This patch revises the definition of open regions to
allow parts being off the board. It solves the test cases
tiny:201,301,401.

- ignore off board vertices in openregion() in fuseki.c

/Gunnar

Index: engine/fuseki.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/fuseki.c,v
retrieving revision 1.24
diff -u -r1.24 fuseki.c
--- engine/fuseki.c     8 Nov 2004 04:10:02 -0000       1.24
+++ engine/fuseki.c     7 Mar 2005 14:04:39 -0000
@@ -69,6 +69,19 @@
   if (j1 > j2)
     return openregion(i1, i2, j2, j1);
 
+  /* Disregard parts of the region off the board. This is convenient
+   * in order not to have to special-case tiny boards. It also secures
+   * against potential reading outside the board[] array boundaries.
+   */
+  if (i1 < 0)
+    i1 = 0;
+  if (j1 < 0)
+    j1 = 0;
+  if (i2 >= board_size)
+    i2 = board_size - 1;
+  if (j2 >= board_size)
+    j2 = board_size - 1;
+    
   for (x = i1; x <= i2; x++)
     for (y = j1; y <= j2; y++)
       if (BOARD(x, y) != EMPTY)


_______________________________________________
gnugo-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnugo-devel

Reply via email to