[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] Fuseki patch for tiny boards
From: |
Gunnar Farnebäck |
Subject: |
[gnugo-devel] Fuseki patch for tiny boards |
Date: |
Sun, 13 Mar 2005 00:30:01 +0100 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI) |
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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] Fuseki patch for tiny boards,
Gunnar Farnebäck <=