gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] semeai patch


From: Gunnar Farneback
Subject: Re: [gnugo-devel] semeai patch
Date: Mon, 01 Dec 2003 01:11:47 +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)

I wrote:
> blunder:26
> Possibly a real failure, needs further investigation.

Fixed by the appended patch. Regression delta is

blunder:26      PASS C19 [!D19|F17]
strategy:13     FAIL L17 [N18]
nicklas1:1213   PASS N4 [N4]
ninestones:40   PASS K19 [!D2]

The new failure of strategy:13 is incidental. The semeai reading has
been improved (L16 is correctly considered alive, not critical). The
problem is that the tactical reading of L16 is incorrect (thinks it's
critical) which in turn causes a very bad move valuation failure,
where the influence code contributes a negative delta territory value
for N18, although it has lots of owl and semeai move reasons.

The tactical problem has been added as reading:193. I also think we
should fix the influence/move valuation problem so that inconsistent
semeai/tactical results can't cause such a severe mistake.

- consider semeai worms adjacent to the outside as important in
  owl_analyze_semeai_after_move()
- additional semeai debug output
- new test case

/Gunnar

Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.184
diff -u -r1.184 owl.c
--- engine/owl.c        29 Nov 2003 08:56:33 -0000      1.184
+++ engine/owl.c        1 Dec 2003 00:00:03 -0000
@@ -336,6 +336,8 @@
   int save_verbose = verbose;
   int dummy_resulta;
   int dummy_resultb;
+  double start = 0.0;
+  int reading_nodes_when_called = get_reading_node_counter();
 
   struct local_owl_data *owla;
   struct local_owl_data *owlb;
@@ -345,6 +347,9 @@
   if (!resultb)
     resultb = &dummy_resultb;
 
+  if (debug & DEBUG_OWL_PERFORMANCE)
+    start = gg_cputime();
+  
   /* Look for owl substantial worms of either dragon adjoining
    * the other dragon. Capturing such a worm wins the semeai.
    * These are the semeai_worms. This code must come before
@@ -372,10 +377,35 @@
     verbose--;
   for (str = BOARDMIN; str < BOARDMAX; str++) 
     if (ON_BOARD(str) && ms[str] && worm[str].origin == str) {
-      /* FIXME: Consider also strings neighboring the outside as
-       * critical semeai worms.
+      int adj;
+      int adjs[MAXCHAIN];
+      int k;
+      int adjacent_to_outside = 0;
+
+      /* Is the string adjacent to a living dragon outside the semeai?
+       * In that case it's important to attack/defend it for the life
+       * of the opponent.
+       *
+       * FIXME: Checking crude_status here isn't quite appropriate but
+       * owl_status is not always computed and status itself is unsafe
+       * since it might change before later calls to this code, e.g.
+       * when checking for blunders.
+       *
+       * Not checking for aliveness at all gives problems in e.g.
+       * ld_owl:302 where S19 is a separate dragon and R19 should not
+       * be considered critically important. What we really would like
+       * to determine is whether it's outside the semeai, however.
        */
-      if (countstones(str) > 6 && s_worms < MAX_SEMEAI_WORMS) {
+      adj = chainlinks(str, adjs);
+      for (k = 0; k < adj; k++) {
+       if (!is_same_dragon(adjs[k], apos)
+           && !is_same_dragon(adjs[k], bpos)
+           && dragon[adjs[k]].crude_status == ALIVE)
+         adjacent_to_outside = 1;
+      }
+      
+      if ((adjacent_to_outside || countstones(str) > 6)
+         && s_worms < MAX_SEMEAI_WORMS) {
        important_semeai_worms[s_worms] = 1;
        semeai_worms[s_worms++] = str;
        DEBUG(DEBUG_SEMEAI, "important semeai worm: %1m\n", str);
@@ -442,6 +472,22 @@
     *resultb = REVERSE_RESULT(*resultb);
   }
 
+  if (move == PASS_MOVE) {
+    DEBUG(DEBUG_OWL_PERFORMANCE,
+         "analyze_semeai %1m vs. %1m, result %d %d %1m (%d, %d nodes, %f 
seconds)\n",
+         apos, bpos, *resulta, *resultb, semeai_move, local_owl_node_counter,
+         get_reading_node_counter() - reading_nodes_when_called,
+         gg_cputime() - start);
+  }
+  else {
+    DEBUG(DEBUG_OWL_PERFORMANCE,
+         "analyze_semeai_after_move %C %1m: %1m vs. %1m, result %d %d %1m (%d, 
%d nodes, %f seconds)\n",
+         color, move, apos, bpos, *resulta, *resultb, semeai_move,
+         local_owl_node_counter,
+         get_reading_node_counter() - reading_nodes_when_called,
+         gg_cputime() - start);
+  }
+  
   if (semeai_result_certain)
     *semeai_result_certain = result_certain;
 }
Index: regression/reading.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/reading.tst,v
retrieving revision 1.62
diff -u -r1.62 reading.tst
--- regression/reading.tst      29 Nov 2003 19:33:37 -0000      1.62
+++ regression/reading.tst      1 Dec 2003 00:00:03 -0000
@@ -801,6 +801,11 @@
 192 attack D4
 #? [0]
 
+# See also strategy:13.
+loadsgf games/incident108b.sgf 292
+193 attack L16
+#? [0]
+
 # Report number of nodes visited by the tactical reading
 10000 get_reading_node_counter
 #? [0]&
Index: regression/strategy.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/strategy.tst,v
retrieving revision 1.57
diff -u -r1.57 strategy.tst
--- regression/strategy.tst     29 Nov 2003 19:33:37 -0000      1.57
+++ regression/strategy.tst     1 Dec 2003 00:00:03 -0000
@@ -71,6 +71,7 @@
 #? [N4]
 
 # incident 113
+# See also reading:193
 loadsgf games/incident108b.sgf 292
 13 reg_genmove black
 #? [N18]




reply via email to

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