gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Patch for break_chain3_moves


From: SP Lee
Subject: [gnugo-devel] Patch for break_chain3_moves
Date: Fri, 23 Jan 2004 09:34:42 -0800

The following tweak makes gnugo generate more aggressive chain breaking
moves. The regression breakage (I might overlook some cases because
there are recently lots of regression changes on the cvs):

./regress.sh . reading.tst
194 unexpected PASS!
./regress.sh . strategy.tst
13 unexpected PASS!
./regress.sh . lazarus.tst
5 unexpected PASS!
13 unexpected PASS!
./regress.sh . nngs.tst
370 unexpected PASS!
371 unexpected PASS!
./regress.sh . strategy3.tst
119 unexpected PASS!
./regress.sh . owl1.tst
263 unexpected PASS!
./regress.sh . century2002.tst
140 unexpected PASS!
./regress.sh . 9x9.tst
210 unexpected PASS!

./regress.sh . reading.tst
64 unexpected FAIL: Correct '3 N1', got '1 R3'
./regress.sh . arb.tst
203 unexpected FAIL: Correct 'T7', got 'N3'
./regress.sh . seki.tst
206 unexpected FAIL: Correct 'A1', got 'C9'
811 unexpected FAIL: Correct 'A1', got 'C9'

These fails are all related to ko. Since now more moves are generated,
the ko's may make things more complicated. I'll check this later.

./regress.sh . 13x13.tst
39 unexpected FAIL: Correct 'H4|J4', got 'J5'

Actually I think J5 is not a bad move for this case.

./regress.sh . strategy4.tst
190 unexpected FAIL: Correct 'D13', got 'E14'

D13 is better for sure, but E14 maybe also not bad, yet E14 generates
many aji's.

SP Lee

$ cvs diff -u reading.c
Index: reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.135
diff -u -r1.135 reading.c
--- reading.c   21 Jan 2004 18:39:11 -0000      1.135
+++ reading.c   23 Jan 2004 08:21:15 -0000
@@ -4556,29 +4556,39 @@

     /* If the 3 liberty chain easily can run away through one of the
      * liberties, we don't play on any of the other liberties.
+     * Usually it's not easy to escape from the 3 liberties, but
+     * there are cases like (O to break chain of X's):
+     *  ..XXXX
+     *  .a...X
+     *  bXOOOX  If X plays on a, the leftmost chain's no. liberties is
+     *  .cX.XX       changed to 5, b to 5 and c to 6.
+     *  ......
+     *  If X plays on any of the liberties to change the total
+     *  liberties to 4, it's still not easy to escape since it's O's
+     *  turn to move and the liberties can be reduced back.
      */
-    lib1 = approxlib(libs[0], other, 4, NULL);
-    lib2 = approxlib(libs[1], other, 4, NULL);
-    if (lib1 >= 4 && lib2 >= 4)
+    lib1 = approxlib(libs[0], other, 5, NULL);
+    lib2 = approxlib(libs[1], other, 5, NULL);
+    if (lib1 >= 5 && lib2 >= 5)
       continue;
-    lib3 = approxlib(libs[2], other, 4, NULL);
+    lib3 = approxlib(libs[2], other, 5, NULL);

-    if ((lib1 >= 4 || lib2 >= 4) && lib3 >= 4)
+    if ((lib1 >= 5 || lib2 >= 5) && lib3 >= 5)
       continue;

-    if (lib1 >= 4 && !mw[libs[0]]) {
+    if (lib1 >= 5 && !mw[libs[0]]) {
       mw[libs[0]] = 1;
       possible_moves[u++] = libs[0];
       continue;
     }

-    if (lib2 >= 4 && !mw[libs[1]]) {
+    if (lib2 >= 5 && !mw[libs[1]]) {
       mw[libs[1]] = 1;
       possible_moves[u++] = libs[1];
       continue;
     }

-    if (lib3 >= 4 && !mw[libs[2]]) {
+    if (lib3 >= 5 && !mw[libs[2]]) {
       mw[libs[2]] = 1;
       possible_moves[u++] = libs[2];
       continue;
@@ -4605,13 +4615,21 @@
      * (This currently only makes a difference at stackp ==
backfill2_depth.)
      */
     int xpos = possible_moves[v];
+    int lib_stone = approxlib(xpos, color, 3, libs);
     if (stackp <= break_chain_depth
        || (be_aggressive && stackp <= backfill_depth)
-       || approxlib(xpos, color, 2, NULL) > 1)
-      /* We use a negative initial score here as we prefer to find
-       * direct defense moves.
-       */
-      ADD_CANDIDATE_MOVE(xpos, -2, *moves, "break_chain3");
+       || lib_stone > 1) {
+       /* When the stone for chain breaking has 2 liberties, it is only
+        * safe when it's opponent would reduce own liberty to 1 while
+        * trying to catch the chain breaking stone.
+        */
+        if ((lib_stone != 2) || approxlib(libs[0], other, 3, NULL) == 2
||
+          approxlib(libs[1], other, 3, NULL) == 2)
+        /* We use a negative initial score here as we prefer to find
+         * direct defense moves.
+         */
+          ADD_CANDIDATE_MOVE(xpos, -2, *moves, "break_chain3");
+      }
   }
 }








reply via email to

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