gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Bugfix in connections.c


From: Gunnar Farneback
Subject: [gnugo-devel] Bugfix in connections.c
Date: Thu, 21 Nov 2002 20:05:14 +0100
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)

This patch fixes a bug in connections.c caused by a mistake in the
implementation of --experimental-connections. Additionally it only
allows amalgamation of stones matching O in C patterns. Previously
also stones matching o could be amalgamated.

The results are that connection:96 passes properly solved and that
trevora:130 accidentally fails. More interestingly this also reduces
the number of connection nodes from 6347835 to 5430869, or 14%, for
the whole set of regressions. The owl nodes are essentially unchanged
and the reading nodes are reduced by 8%.

- bugfixes in cut_connect_callback() in connections.c

/Gunnar

Index: patterns/connections.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/connections.c,v
retrieving revision 1.28
diff -u -r1.28 connections.c
--- patterns/connections.c      27 Sep 2002 19:29:52 -0000      1.28
+++ patterns/connections.c      21 Nov 2002 18:49:00 -0000
@@ -61,27 +61,29 @@
    * previously during find_cuts.
    */
 
-  if (!experimental_connections && (pattern->class & CLASS_C)) {
-    for (k = 0; k < pattern->patlen; ++k) { /* match each point */
-      /* transform pattern real coordinate */
-      int pos = AFFINE_TRANSFORM(pattern->patn[k].x, pattern->patn[k].y,
-                                ll, m, n);
-      if (board[pos]==EMPTY
-         && ((color == WHITE
-              && (white_eye[pos].type & INHIBIT_CONNECTION))
-             || (color == BLACK
+  if (pattern->class & CLASS_C) {
+    if (!experimental_connections) {
+      for (k = 0; k < pattern->patlen; ++k) { /* match each point */
+       /* transform pattern real coordinate */
+       int pos = AFFINE_TRANSFORM(pattern->patn[k].x, pattern->patn[k].y,
+                                  ll, m, n);
+       if (board[pos]==EMPTY
+           && ((color == WHITE
+                && (white_eye[pos].type & INHIBIT_CONNECTION))
+               || (color == BLACK
                  && (black_eye[pos].type & INHIBIT_CONNECTION)))) {
-       DEBUG(DEBUG_DRAGONS, 
-             "Connection pattern of type %s inhibited at %1m\n",
-             pattern->name, pos);
-       return;
+         DEBUG(DEBUG_DRAGONS, 
+               "Connection pattern of type %s inhibited at %1m\n",
+               pattern->name, pos);
+         return;
+       }
       }
-    }  
+    }
 
-  /* If C pattern, test if there are more than one dragon in this
-   * pattern so that there is something to connect, before doing any
-   * expensive reading.
-   */
+    /* If C pattern, test if there are more than one dragon in this
+     * pattern so that there is something to connect, before doing any
+     * expensive reading.
+     */
 
     for (k = 0; k < pattern->patlen; ++k) { /* match each point */
       /* transform pattern real coordinate */
@@ -193,6 +195,7 @@
      */
     if ((pattern->class & CLASS_C)
        && board[pos] == color
+       && pattern->patn[k].att == ATT_O
        && ((pattern->class & CLASS_s) || worm[pos].attack_codes[0] == 0)) {
       if (first_dragon == NO_MOVE)
        first_dragon = dragon[pos].origin;




reply via email to

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