gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] mixed patch


From: Gunnar Farneback
Subject: [gnugo-devel] mixed patch
Date: Mon, 14 Jan 2002 21:26:39 +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)

Here's a patch with mixed and not terribly exciting contents.

- debug printing in influence.c slightly restructured
- new function influence_moyo_color_opposite()
- one trace output reenabled in confirm_safety()
- new connection and filllib test cases

/Gunnar

Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.27
diff -u -r1.27 influence.c
--- engine/influence.c  10 Jan 2002 08:34:22 -0000      1.27
+++ engine/influence.c  14 Jan 2002 20:11:42 -0000
@@ -36,7 +36,8 @@
                                  float attenuation,
                                  struct influence_data *q);
 static void segment_influence(struct influence_data *q);
-static void print_influence(struct influence_data *q, int dragons_known);
+static void print_influence(struct influence_data *q,
+                           const char *info_string);
 static void print_numeric_influence(struct influence_data *q,
                                    float values[MAX_BOARD][MAX_BOARD],
                                    const char *format, int draw_stones,
@@ -805,11 +806,16 @@
   /* FIXME: The "board_size - 19" stuff below is an ugly workaround for a bug
    *        in main.c
    */
-  if ((q == &initial_influence
+  if (((q == &initial_influence || q == &initial_opposite_influence)
        && (printmoyo & PRINTMOYO_INITIAL_INFLUENCE))
       || (m == (board_size - 19) + debug_influence_i
-         && n == debug_influence_j && m >= 0))
-    print_influence(q, dragons_known);
+         && n == debug_influence_j && m >= 0)) {
+    if (q == &initial_opposite_influence)
+      print_influence(q, (dragons_known ? "dragons_known, opposite, color"
+                         : "dragons_unknown, opposite, color"));
+    else
+      print_influence(q, dragons_known ? "dragons_known" : "dragons_unknown");
+  }
 }
 
 /* Return the color of the territory at (m, n). If it's territory for
@@ -1118,8 +1124,7 @@
  * initial_opposite_influence is used, otherwise initial_influence.
  */
 void
-influence_get_moyo_segmentation(int opposite, 
-                                struct moyo_data *moyos)
+influence_get_moyo_segmentation(int opposite, struct moyo_data *moyos)
 {
   int m, n;
   int min_moyo_id;
@@ -1284,6 +1289,15 @@
   return whose_moyo(&initial_influence, I(pos), J(pos));
 }
 
+/* Return the color who has moyo at pos, or EMPTY, using influence
+ * computed with the opposite color to move.
+ */
+int
+influence_moyo_color_opposite(int pos)
+{
+  return whose_moyo(&initial_opposite_influence, I(pos), J(pos));
+}
+
 /* Return the color who has area at pos, or EMPTY. */
 int
 influence_area_color(int pos)
@@ -1484,7 +1498,11 @@
 print_initial_influence(int color, int dragons_known)
 {
   compute_initial_influence(color, dragons_known);
-  print_influence(&initial_influence, dragons_known);
+  print_influence(&initial_influence, (dragons_known ? "dragons_known"
+                                      : "dragons_unknown"));
+  print_influence(&initial_opposite_influence,
+                 dragons_known ? "dragons_known, opposite color"
+                 : "dragons_unknown, opposite color");
 }
 
 /* Compute influence after doing a move and print it. Notice that it's
@@ -1495,20 +1513,18 @@
                     char saved_stones[BOARDMAX])
 {
   compute_move_influence(I(pos), J(pos), color, saved_stones);
-  print_influence(&move_influence, 1);
+  print_influence(&move_influence, "after move, dragons known");
 }
 
 /* Print influence for debugging purposes. */
 static void
-print_influence(struct influence_data *q, int dragons_known)
+print_influence(struct influence_data *q, const char *info_string)
 {
   if (printmoyo & PRINTMOYO_ATTENUATION) {
     /* Print the attenuation values. */
-    fprintf(stderr, "white attenuation (%s):\n",
-           dragons_known ? "dragons known" : "dragons unknown");
+    fprintf(stderr, "white attenuation (%s):\n", info_string);
     print_numeric_influence(q, q->white_attenuation, "%3.2f", 0, 0);
-    fprintf(stderr, "black attenuation (%s):\n",
-           dragons_known ? "dragons known" : "dragons unknown");
+    fprintf(stderr, "black attenuation (%s):\n", info_string);
     print_numeric_influence(q, q->black_attenuation, "%3.2f", 0, 0);
   }
 
@@ -1532,19 +1548,16 @@
 
   if (printmoyo & PRINTMOYO_NUMERIC_INFLUENCE) {
     /* Print the white influence values. */
-    fprintf(stderr, "white influence (%s):\n",
-           dragons_known ? "dragons known" : "dragons unknown");
+    fprintf(stderr, "white influence (%s):\n", info_string);
     print_numeric_influence(q, q->white_influence, "%3.0f", 1, 1);
     
     /* Print the black influence values. */
-    fprintf(stderr, "black influence (%s):\n",
-           dragons_known ? "dragons known" : "dragons unknown");
+    fprintf(stderr, "black influence (%s):\n", info_string);
     print_numeric_influence(q, q->black_influence, "%3.0f", 1, 1);
   }
 
   if (printmoyo & PRINTMOYO_PRINT_INFLUENCE) {
-    fprintf(stderr, "influence regions (%s):\n",
-           dragons_known ? "dragons known" : "dragons unknown");
+    fprintf(stderr, "influence regions (%s):\n", info_string);
     print_influence_areas(q);
   }
 }
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.66
diff -u -r1.66 liberty.h
--- engine/liberty.h    8 Jan 2002 16:25:30 -0000       1.66
+++ engine/liberty.h    14 Jan 2002 20:11:42 -0000
@@ -482,6 +482,7 @@
                                char saved_stones[BOARDMAX]);
 int influence_territory_color(int pos);
 int influence_moyo_color(int pos);
+int influence_moyo_color_opposite(int pos);
 int influence_area_color(int pos);
 int influence_get_moyo_size(int pos, int color);
 void influence_get_moyo_segmentation(int opposite, struct moyo_data *moyo);
Index: engine/utils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/utils.c,v
retrieving revision 1.30
diff -u -r1.30 utils.c
--- engine/utils.c      3 Jan 2002 21:37:04 -0000       1.30
+++ engine/utils.c      14 Jan 2002 20:11:44 -0000
@@ -731,6 +731,9 @@
  * For use when called from fill_liberty, this function may optionally
  * return a point of defense, which, if taken, will presumably make
  * the move at (i, j) safe on a subsequent turn.
+ *
+ * FIXME: Most TRACE calls below are ineffective because we have
+ * decreased the verbose value to avoid traces in the owl code. Oops.
  */
 
 int
@@ -760,8 +763,8 @@
     ASSERT_ON_BOARD1(apos);
     if (defense_point)
       *defense_point = apos;
-    TRACE("Combination attack appears at %1m.\n", apos);
     verbose = save_verbose;
+    TRACE("Combination attack appears at %1m.\n", apos);
     return 0;
   }
 
Index: regression/connection.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/connection.tst,v
retrieving revision 1.15
diff -u -r1.15 connection.tst
--- regression/connection.tst   16 Dec 2001 15:57:36 -0000      1.15
+++ regression/connection.tst   14 Jan 2002 20:11:47 -0000
@@ -117,7 +117,7 @@
 
 loadsgf games/trevor/auto/a035.sgf 28
 33 disconnect B4 C6
-#? [B5]*
+#? [1 B5]*
 
 # Monkey jumps and relatives.
 loadsgf games/connection3.sgf
@@ -164,6 +164,47 @@
 loadsgf games/trevor/auto/a014.sgf 16
 50 disconnect B5 C2
 #? [1 B4]
+
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 108
+51 connect R14 Q16
+#? [1 Q15]*
+52 connect R14 O15
+#? [1 Q15]*
+53 connect S7 S4
+#? [1 T5]*
+
+# D8 might also disconnect.
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 164
+54 disconnect B6 D10
+#? [1 C8]*
+55 connect B6 D10
+#? [1 D8|C8]*
+56 connect B6 F9
+#? [1 D8]*
+
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 192
+57 connect K14 K16
+#? [1 L16]
+
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 204
+58 disconnect D18 F17
+#? [0]
+
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 216
+59 disconnect D18 E15
+#? [1 D15|F15|B15|D19|E19]
+60 connect D14 B18
+#? [1 D15|F15|B15|D19|E19]*
+61 connect O9 Q9
+#? [1 D15|F15|B15|D19|E19]*
+
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 238
+62 connect S18 S14
+#? [1 T15|T17]*
+
+loadsgf games/nngs/Lazarus-gnugo-3.1.19-200201092246.sgf 258
+63 connect N13 N17
+#? [1 N16|O17|P16]*
 
 # Report number of nodes visited by the tactical reading
 10000 get_reading_node_counter
Index: regression/filllib.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/filllib.tst,v
retrieving revision 1.10
diff -u -r1.10 filllib.tst
--- regression/filllib.tst      9 Nov 2001 17:46:17 -0000       1.10
+++ regression/filllib.tst      14 Jan 2002 20:11:47 -0000
@@ -102,3 +102,9 @@
 30 gg_genmove black
 #? [A3|A1|B1]
 
+# Q19 for white is non-orthodox but doesn't lose points.
+loadsgf games/trevor/auto/d29.sgf 188
+31 gg_genmove white
+#? [S16|T17|O18|Q19]*
+32 gg_genmove black
+#? [O18|O19|N18|P19|N19]



reply via email to

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