gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] PATCH: Marginal eye points with opponent stones in eyes.db


From: Inge Wallin
Subject: [gnugo-devel] PATCH: Marginal eye points with opponent stones in eyes.db
Date: Sat, 24 Nov 2001 21:45:57 +0100 (MET)

Well, the subject says it all.  Here is a patch that implements
support for marginal eye points with opponent stones in eyes.db.  The
change was surprisingly simple to make, but the big job is to get all
the patterns that use it correct.  I chose the character '$' for it.
I would have preferred '#', but that was already taken by the comment
character. 

I have also fixed the last patch with atari_atari, and is now running
the regression tests.

Summary:
  - Support for marginal eye points with opponent stones in eyes.db

        -Inge

================================================================

diff -ur gnugo-sync/engine/optics.c gnugo-iw3/engine/optics.c
--- gnugo-sync/engine/optics.c  Fri Nov 16 18:49:03 2001
+++ gnugo-iw3/engine/optics.c   Sat Nov 24 21:54:28 2001
@@ -1482,6 +1482,7 @@
       if (ok && marginal[map[q]]
          && graphs[graph].vertex[q].type != '!'
          && graphs[graph].vertex[q].type != '@'
+         && graphs[graph].vertex[q].type != '$'
          && graphs[graph].vertex[q].type != ')'
          && graphs[graph].vertex[q].type != '(')
        ok = 0;
@@ -1490,16 +1491,19 @@
          && (graphs[graph].vertex[q].type == '!'
              || graphs[graph].vertex[q].type == '('
              || graphs[graph].vertex[q].type == ')'
-             || graphs[graph].vertex[q].type == '@'))
+             || graphs[graph].vertex[q].type == '@'
+             || graphs[graph].vertex[q].type == '$'))
        ok = 0;
       
       if (ok && IS_STONE(board[vpos[map[q]]])
          && graphs[graph].vertex[q].type != 'X'
-         && graphs[graph].vertex[q].type != 'x')
+         && graphs[graph].vertex[q].type != 'x'
+         && graphs[graph].vertex[q].type != '$')
        ok = 0;
       
       if (ok && board[vpos[map[q]]] == EMPTY
-         && graphs[graph].vertex[q].type == 'X')
+         && (graphs[graph].vertex[q].type == 'X'
+             || graphs[graph].vertex[q].type == '$'))
        ok = 0;
 
       if (ok && edge[map[q]] < graphs[graph].vertex[q].edge)
@@ -1604,7 +1608,7 @@
        *defense_point = defense_points[0];
        DEBUG(DEBUG_EYES, "  vital points: %1m (attack) %1m (defense)\n",
              *attack_point, *defense_point);
-       DEBUG(DEBUG_EYES, "  pattern matched:  %d\n", graphs[graph].id);
+       DEBUG(DEBUG_EYES, "  pattern matched:  %s\n", graphs[graph].patname);
 
        if (add_moves) {
          if (eye_color != color) {
@@ -1617,7 +1621,7 @@
          }
        }
       }
-      TRACE("eye space at %1m of type %d\n", pos, graphs[graph].id);
+      TRACE("eye space at %1m of type %s\n", pos, graphs[graph].patname);
 
       return 1;
     }
diff -ur gnugo-sync/patterns/eyes.db gnugo-iw3/patterns/eyes.db
--- gnugo-sync/patterns/eyes.db Sat Nov 17 12:07:36 2001
+++ gnugo-iw3/patterns/eyes.db  Sat Nov 24 21:53:49 2001
@@ -28,6 +28,7 @@
 #     > - ordinary eye space and defense key point (expands)    #
 #     ! - marginal eye space                                    #
 #     @ - marginal eye space and key point, attack/defense      #
+#     $ - marginal eye space containing an opponent stone       #
 #     ( - marginal eye space and attack key point               #
 #     ) - marginal eye space and defense key point              #
 #     X - dead opponent stone                                   #
@@ -71,6 +72,13 @@
 
 Pattern 102
 
+$
+
+:0,0
+
+
+Pattern 103
+
 !
 
 :0,0
@@ -95,6 +103,13 @@
 
 
 Pattern 203
+
+$.
+
+:0,0
+
+
+Pattern 204
 
 !!
 
diff -ur gnugo-sync/patterns/eyes.h gnugo-iw3/patterns/eyes.h
--- gnugo-sync/patterns/eyes.h  Fri Nov 16 18:49:23 2001
+++ gnugo-iw3/patterns/eyes.h   Sat Nov 24 21:41:24 2001
@@ -50,7 +50,7 @@
 
 struct eye_graph {
   struct eye_vertex *vertex;
-  int id;                         /* serial number of pattern              */
+  const char *patname;            /* Name of pattern                       */
   int esize;                      /* number of vertices                    */
   int msize;                      /* number of marginal vertices           */
   int ends;                       /* number of vertices with one neighbor  */
diff -ur gnugo-sync/patterns/mkeyes.c gnugo-iw3/patterns/mkeyes.c
--- gnugo-sync/patterns/mkeyes.c        Fri Nov 16 18:49:25 2001
+++ gnugo-iw3/patterns/mkeyes.c Sat Nov 24 21:54:03 2001
@@ -168,6 +168,11 @@
            num_defenses++;
            break;
            
+         case '$':
+           msize[patno]++;
+           marginal[m][n] = 1;
+           break;
+           
          case '(':
            msize[patno]++;
            marginal[m][n] = 1;
@@ -332,7 +337,7 @@
   printf("\nstruct eye_graph graphs[] = {\n");
   for (l = 0; l < patno; l++) {
 
-    printf("   {eye%d, %d, %d, %d, %d, %d, %d, %d, %d}",
+    printf("   {eye%d, \"%d\", %d, %d, %d, %d, %d, %d, %d}",
           eye_number[l], eye_number[l], esize[l], msize[l], ends[l],
           two_neighbors[l], three_neighbors[l], max[l], min[l]);
     if (l < patno-1)



reply via email to

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