gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] reading patch


From: Gunnar Farneback
Subject: [gnugo-devel] reading patch
Date: Tue, 13 Jan 2004 20:02:06 +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 adds and solves a new reading testcase, related to an
amalgamation mistake in semeai:58. It has no other effects on the
regressions, in particular it doesn't solve semeai:58 in its entirety.
Negligible changes in node counters.

- defend4() and special_rescue_moves() revised
- new test case

/Gunnar

Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.132
diff -u -r1.132 reading.c
--- engine/reading.c    7 Jan 2004 10:00:20 -0000       1.132
+++ engine/reading.c    13 Jan 2004 18:30:32 -0000
@@ -1774,6 +1774,15 @@
   order_moves(str, &moves, color, read_function_name, *move);
   DEFEND_TRY_MOVES(1, &suggest_move);
 
+  if (stackp <= depth) {
+    for (k = 0; k < liberties; k++)
+      special_rescue_moves(str, libs[k], &moves);
+    bamboo_rescue_moves(str, liberties, libs, &moves);
+  }
+
+  order_moves(str, &moves, color, read_function_name, *move);
+  DEFEND_TRY_MOVES(1, &suggest_move);
+
   RETURN_RESULT(savecode, savemove, move, "saved move");
 }
 
@@ -1815,6 +1824,31 @@
       /* Don't play into a self atari. */
       if (is_self_atari(lib + d, color))
        continue;
+
+      /* Be more demanding when the string has four liberties. (Mostly
+       * because attack4() otherwise would need more move generators.)
+       * More precisely we require not only the first order liberty to
+       * become a self atari for the opponent but also one more of the
+       * neighbors of the proposed move. See reading:144 for a
+       * position where we otherwise would try to defend at D9 and
+       * attack4() then lacks move generators to stop black from
+       * continuing towards the top left corner.
+       */
+      if (countlib(str) > 3) {
+       int r;
+       int number_protected = 0;
+       
+       for (r = 0; r < 4; r++) {
+         if (board[lib + d + delta[r]] == EMPTY
+             && approxlib(lib + d + delta[r], other, 3, NULL) < 3)
+           number_protected++;
+         if (number_protected == 2)
+           break;
+       }
+
+       if (number_protected < 2)
+         continue;
+      }
       
       ADD_CANDIDATE_MOVE(lib + d, 0, *moves, "special_rescue");
     }
Index: regression/reading.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/reading.tst,v
retrieving revision 1.65
diff -u -r1.65 reading.tst
--- regression/reading.tst      7 Jan 2004 23:10:32 -0000       1.65
+++ regression/reading.tst      13 Jan 2004 18:30:35 -0000
@@ -810,6 +810,11 @@
 194 attack L16
 #? [0]*
 
+# See also semeai:58.
+loadsgf games/test4lose.sgf
+195 defend H6
+#? [1 J4]
+
 # Report number of nodes visited by the tactical reading
 10000 get_reading_node_counter
 #? [0]&
Index: regression/semeai.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/semeai.tst,v
retrieving revision 1.53
diff -u -r1.53 semeai.tst
--- regression/semeai.tst       7 Jan 2004 23:10:32 -0000       1.53
+++ regression/semeai.tst       13 Jan 2004 18:30:35 -0000
@@ -286,6 +286,7 @@
 57 analyze_semeai C5 H6
 #? [1 1 J4]
 
+# See also reading:195.
 loadsgf games/test4lose.sgf
 58 analyze_semeai F5 H6
 #? [0 0 PASS]*




reply via email to

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