gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] 3.3.12 vs 3.2


From: Gunnar Farneback
Subject: Re: [gnugo-devel] 3.3.12 vs 3.2
Date: Sat, 30 Nov 2002 23:45:03 +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)

Dan wrote:
> Yesterday Gunnar was running twogtp and last I heard he was getting
> a win rate of 55% for 3.3.12.

Not vanilla 3.3.12 but with some patching. It did 144 to 119 as white
against 3.2 before I stopped the series, i.e. a 55% win rate. After
some further tuning I started a new series which did not look
promising when it was lagging 37 to 43 after 80 games but at the end
3.3.12 (still white) did 307 to 193 or a 61.4% win rate.

Below is the final patch I was using. In the first experiment I mainly
had the changes in value_moves(). This patch is not currently ready
for CVS. The regression delta is rather huge (I'm rerunning the
regressions now) and some of the value_moves() changes increase the
amount of owl reading, naturally at a performance cost.

I'll try to split this patch up into smaller pieces which are easier
to evaluate, but this will obviously take a while. If someone feels
like testing some part of the patch you're welcome to help out. Just
contact me so I know what's being done.

/Gunnar

Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.102
diff -u -r1.102 move_reasons.c
--- engine/move_reasons.c       19 Nov 2002 16:32:35 -0000      1.102
+++ engine/move_reasons.c       30 Nov 2002 22:23:05 -0000
@@ -604,7 +604,7 @@
  * Check whether an owl attack/defense move reason is recorded for a move.
  * A negative value for 'what' means only match 'type'.
  */
-static int
+int
 owl_move_reason_known(int pos, int what)
 {
   return (owl_attack_move_reason_known(pos, what)
Index: engine/move_reasons.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.h,v
retrieving revision 1.27
diff -u -r1.27 move_reasons.h
--- engine/move_reasons.h       19 Nov 2002 16:32:35 -0000      1.27
+++ engine/move_reasons.h       30 Nov 2002 22:23:05 -0000
@@ -193,6 +193,7 @@
 int defense_move_reason_known(int pos, int what);
 int owl_attack_move_reason_known(int pos, int what);
 int owl_defense_move_reason_known(int pos, int what);
+int owl_move_reason_known(int pos, int what);
 int get_biggest_owl_target(int pos);
 int is_antisuji_move(int pos);
 
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.68
diff -u -r1.68 value_moves.c
--- engine/value_moves.c        30 Nov 2002 16:20:42 -0000      1.68
+++ engine/value_moves.c        30 Nov 2002 22:23:10 -0000
@@ -252,6 +252,7 @@
  * 2. Vital eye points for the dragon.
  * 3. Tactical attacks or defenses for a part of the dragon.
  * 4. Moves connecting the dragon to something else.
+ * 5. Moves cutting the dragon from something else.
  */
 static void
 find_more_owl_attack_and_defense_moves(int color)
@@ -300,7 +301,8 @@
        if (dd1 == NO_MOVE) /* Maybe we should assert this not to happen. */
          continue;
       }      
-      else if (move_reasons[r].type == CONNECT_MOVE) {
+      else if (move_reasons[r].type == CONNECT_MOVE
+              || move_reasons[r].type == CUT_MOVE) {
        int worm1 = conn_worm1[move_reasons[r].what];
        int worm2 = conn_worm2[move_reasons[r].what];
        dd1 = dragon[worms[worm1]].origin;
@@ -328,6 +330,7 @@
          continue;
        
        if ((move_reasons[r].type == STRATEGIC_ATTACK_MOVE 
+            || move_reasons[r].type == CUT_MOVE
             || move_reasons[r].type == ATTACK_MOVE
             || move_reasons[r].type == ATTACK_MOVE_GOOD_KO
             || move_reasons[r].type == ATTACK_MOVE_BAD_KO
@@ -468,6 +471,8 @@
   int k;
   int i, j;
   int aa;
+  int num_adj;
+  int adjs[MAXCHAIN];
   
   for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
     if (!ON_BOARD(pos))
@@ -483,7 +488,6 @@
          || move_reasons[r].type == DEFEND_MOVE) {
        int attack_move;
        int color_to_move;
-       int num_adj, adjs[MAXCHAIN];
        
        aa = worms[move_reasons[r].what];
        
@@ -502,7 +506,8 @@
        /* Don't care about inessential dragons. */
        if (DRAGON2(aa).safety == INESSENTIAL)
          continue;
-       
+
+#if 0  
        /*
         * If this is a defense move and the defense is futile for
         * strategical reasons, we shouldn't induce a cutting move
@@ -512,7 +517,8 @@
         */
        if (!attack_move && !move[pos].move_safety)
          continue;
-       
+#endif 
+
        num_adj = extended_chainlinks(aa, adjs, 1);
        
        for (i = 0; i < num_adj; i++) {
@@ -580,30 +586,31 @@
            add_strategical_defense_move(pos, bb);
        }
       }
-      else if (move_reasons[r].type == CONNECT_MOVE
-             && cut_possible(pos, OTHER_COLOR(color))) {
-       int worm1 = worms[conn_worm1[move_reasons[r].what]];
-       int worm2 = worms[conn_worm2[move_reasons[r].what]];
-       int pos2;
-       for (pos2 = BOARDMIN; pos2 < BOARDMAX; pos2++)
-         if (ON_BOARD(pos2) && board[pos2] == EMPTY
-             && cut_possible(pos2, OTHER_COLOR(color))
-             && bdist(pos, pos2) <= 5)
-           for (j = 0; j < 8; j++) {
-             int pos3 = pos2 + delta[j];
-             if (ON_BOARD(pos3) && board[pos3] == color
-                 && !is_same_worm(pos3, worm1)
-                 && !is_same_worm(pos3, worm2)) {
-               if (trymove(pos, color, "induce_secondary_move_reasons-B",
-                           worm1, EMPTY, NO_MOVE)) {
-                 if (!disconnect(pos3, worm1, NULL))
-                   add_connection_move(pos, pos3, worm1);
-                 if (!disconnect(pos3, worm2, NULL))
-                   add_connection_move(pos, pos3, worm2);
-                 popgo();
-               }
-             }
-           }
+      else if (move_reasons[r].type == CONNECT_MOVE) {
+       /* FIXME: Merge with a nando patch. */
+       int w;
+       char mx[BOARDMAX];
+       memset(mx, 0, sizeof(mx));
+       for (i = 0; i < 2; i++) {
+         if (i == 0)
+           w = worms[conn_worm1[move_reasons[r].what]];
+         else
+           w = worms[conn_worm2[move_reasons[r].what]];
+         
+         num_adj = extended_chainlinks(w, adjs, 1);
+         for (j = 0; j < num_adj; j++) {
+           if (dragon[adjs[j]].status == CRITICAL)
+             mx[dragon[adjs[j]].origin] |= (i + 1);
+         }
+       }
+       for (w = BOARDMIN; w < BOARDMAX; w++) {
+         if (mx[w] != 0) {
+           if (board[w] == color)
+             add_strategical_defense_move(pos, w);
+           else
+             add_strategical_attack_move(pos, w);
+         }
+       }
       }
     }
   }
@@ -1985,6 +1992,13 @@
                        && !does_attack(pos, bb))))
              this_value = 0.0;
 
+           /* If this dragon can be owl attacked and the move
+             * does not defend or attack, no points.
+            */
+           if (dragon[bb].status == CRITICAL
+               && !owl_move_reason_known(pos, find_dragon(bb)))
+             this_value = 0.0;
+
            /* If we are doing scoring, are alive, and the move loses
              * territory, no points.
             */
@@ -2121,6 +2135,16 @@
        if (doing_scoring && !move[pos].move_safety)
          break;
 
+       /* This is not quite satisfactory. Cut moves have a tendency
+         * not to have support from move reason marking them as safe
+         * although they are.
+        *
+        * On the other hand they frequently are unsafe, so we can't
+        * just remove this test.
+        */
+       if (!move[pos].move_safety && !adjacent_to_nondead_stone(pos, color))
+         break;
+
        worm1 = conn_worm1[move_reasons[r].what];
        worm2 = conn_worm2[move_reasons[r].what];
        aa = dragon[worms[worm1]].origin;
@@ -2138,24 +2162,29 @@
          this_value = connection_value(aa, bb, pos, gg_abs(score));
        else
          this_value = connection_value(aa, bb, pos, 0);
-       if (this_value > dragon_value[d1]) {
-         dragon_value[d1] = this_value;
-          DEBUG(DEBUG_MOVE_REASONS,
-               "  %1m:   %f - %1m cut/connect strategic value\n",
-               pos, this_value, aa);
-       }
 
+       if (dragon[aa].status != CRITICAL || owl_move_reason_known(pos, d1)) {
+         if (this_value > dragon_value[d1]) {
+           dragon_value[d1] = this_value;
+           DEBUG(DEBUG_MOVE_REASONS,
+                 "  %1m:   %f - %1m cut/connect strategic value\n",
+                 pos, this_value, aa);
+         }
+       }
        
        if ((color == WHITE && score > 20.0)
            || (color == BLACK && score < -20.0))
          this_value = connection_value(bb, aa, pos, gg_abs(score));
        else
          this_value = connection_value(bb, aa, pos, 0);
-       if (this_value > dragon_value[d2]) {
-         dragon_value[d2] = this_value;
-          DEBUG(DEBUG_MOVE_REASONS,
-               "  %1m:   %f - %1m cut/connect strategic value\n",
-               pos, this_value, bb);
+
+       if (dragon[bb].status != CRITICAL || owl_move_reason_known(pos, d2)) {
+         if (this_value > dragon_value[d2]) {
+           dragon_value[d2] = this_value;
+           DEBUG(DEBUG_MOVE_REASONS,
+                 "  %1m:   %f - %1m cut/connect strategic value\n",
+                 pos, this_value, bb);
+         }
        }
        
        break;
@@ -2259,7 +2288,14 @@
              this_value = 0.0;
          }
        }
-               
+
+       /* No points if the dragon is critical. Either this move is
+        * ineffective or it's scored elsewhere.
+        * FIXME: This could probably be implemented as a discard_rule.
+        */
+       if (dragon[aa].status == CRITICAL)
+         this_value = 0.0;
+       
        if (this_value > dragon_value[d1]) {
          dragon_value[d1] = this_value;
           DEBUG(DEBUG_MOVE_REASONS,
@@ -2455,7 +2491,7 @@
       /* We adjust the value according to followup and reverse followup
        * values.
        */
-      contribution = gg_min(gg_min(0.5 * followup_value
+      contribution = gg_min(gg_min(0.55 * followup_value
                                   + 0.5 * move[pos].reverse_followup_value,
                                   1.0 * tot_value
                                   + followup_value),
@@ -2995,6 +3031,9 @@
     time_report(2, "  find_more_attack_and_defense_moves", NO_MOVE, 1.0);
   }
 
+  induce_secondary_move_reasons(color);
+  time_report(2, "  induce_secondary_move_reasons", NO_MOVE, 1.0);
+  
   save_verbose = verbose;
   if (verbose > 0)
     verbose--;
@@ -3010,10 +3049,6 @@
   time_report(2, "  examine_move_safety", NO_MOVE, 1.0);
   verbose = save_verbose;
 
-  /* We can't do this until move_safety is known. */
-  induce_secondary_move_reasons(color);
-  time_report(2, "  induce_secondary_move_reasons", NO_MOVE, 1.0);
-    
   if (printworms || verbose)
     list_move_reasons(color);
 
Index: patterns/barriers.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/barriers.db,v
retrieving revision 1.41
diff -u -r1.41 barriers.db
--- patterns/barriers.db        10 Oct 2002 21:19:27 -0000      1.41
+++ patterns/barriers.db        30 Nov 2002 22:23:12 -0000
@@ -953,6 +953,19 @@
 ;oplay_attack(a,b,C)
 
 
+Pattern Barrier66
+# gf New pattern. (3.3.13)
+
+|..X...
+|......
+|..XO..
+|..,,..
+|..,...
+|......
++------
+
+:8,D
+
 
 Pattern Intrusion1
 
Index: patterns/conn.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/conn.db,v
retrieving revision 1.31
diff -u -r1.31 conn.db
--- patterns/conn.db    23 Oct 2002 18:31:35 -0000      1.31
+++ patterns/conn.db    30 Nov 2002 22:23:12 -0000
@@ -824,7 +824,7 @@
 XO
 b!
 
-;!xplay_connect(*,a,b)
+;xplay_connect(a,b) && !xplay_connect(*,a,b)
 
 
 Pattern CB17
Index: patterns/connections.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/connections.c,v
retrieving revision 1.29
diff -u -r1.29 connections.c
--- patterns/connections.c      22 Nov 2002 07:02:14 -0000      1.29
+++ patterns/connections.c      30 Nov 2002 22:23:12 -0000
@@ -219,10 +219,14 @@
     if (pattern->class & CLASS_B) {
       if (pattern->patn[k].att != ATT_not)
        break; /* The inhibition points are guaranteed to come first. */
-      if (color == WHITE && white_eye[pos].color == WHITE_BORDER)
+      if (color == WHITE && white_eye[pos].color == WHITE_BORDER) {
        white_eye[pos].type |= INHIBIT_CONNECTION;
-      else if (color == BLACK && black_eye[pos].color == BLACK_BORDER)
+       DEBUG(DEBUG_DRAGONS, "inhibiting connection at %1m\n", pos);
+      }
+      else if (color == BLACK && black_eye[pos].color == BLACK_BORDER) {
        black_eye[pos].type |= INHIBIT_CONNECTION;
+       DEBUG(DEBUG_DRAGONS, "inhibiting connection at %1m\n", pos);
+      }
     }
   } /* loop over elements */
 }
Index: patterns/endgame.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/endgame.db,v
retrieving revision 1.39
diff -u -r1.39 endgame.db
--- patterns/endgame.db 15 Nov 2002 11:15:42 -0000      1.39
+++ patterns/endgame.db 30 Nov 2002 22:23:13 -0000
@@ -1452,11 +1452,17 @@
 Pattern CE29
 # tm New Pattern (3.1.20)  (see trevord:950)
 # FIXME: this pattern better in patterns.db?
+# gf Added constraint. (3.3.13) (see gunnar:18)
 
 X*X    Wedge
 O.X
 
 :8,OXe
+
+B*X
+OaX
+
+;oplay_attack_either(*,a,a,B)
 
 
 Pattern CE30
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.92
diff -u -r1.92 mkpat.c
--- patterns/mkpat.c    18 Nov 2002 06:03:52 -0000      1.92
+++ patterns/mkpat.c    30 Nov 2002 22:23:17 -0000
@@ -212,6 +212,10 @@
   {"x_somewhere",             -1, 0.01,
                 "somewhere(OTHER_COLOR(color), 0, 1+%d"},
   {"o_somewhere",             -1, 0.01, "somewhere(color, 0, 1+%d"},
+  {"xmoyo_opposite",                   1, 0.01,
+               "(influence_moyo_color_opposite(%s) == OTHER_COLOR(color))"},
+  {"omoyo_opposite",                   1, 0.01,
+               "(influence_moyo_color_opposite(%s) == color)"},
   {"xmoyo",                    1, 0.01,
                "(influence_moyo_color(%s) == OTHER_COLOR(color))"},
   {"omoyo",                    1, 0.01,
Index: patterns/owl_attackpats.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/owl_attackpats.db,v
retrieving revision 1.66
diff -u -r1.66 owl_attackpats.db
--- patterns/owl_attackpats.db  12 Nov 2002 13:41:55 -0000      1.66
+++ patterns/owl_attackpats.db  30 Nov 2002 22:23:19 -0000
@@ -3017,6 +3017,21 @@
 ;owl_escape_value(C)>0 && xplay_attack_either(*,a,a,b)
 
 
+Pattern A1005b
+
+X?          cut!
+*O
+.Y
+
+:8,-,value(90)
+
+C?
+*b
+aY
+
+;owl_escape_value(C)>0 && xplay_attack_either(*,a,a,b)
+
+
 Pattern A1006
 
 XOY        push out
Index: patterns/patterns.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v
retrieving revision 1.89
diff -u -r1.89 patterns.db
--- patterns/patterns.db        25 Nov 2002 19:37:12 -0000      1.89
+++ patterns/patterns.db        30 Nov 2002 22:23:26 -0000
@@ -2470,6 +2470,7 @@
 #  see trevora:610
 #FIXME: There's still a problem here, in that this sacrifice
 #       is deemed unsafe, and not played....
+# gf Is this really a cut pattern? (3.3.13)
 
 OOO    block or cut into black's territory.
 ...
@@ -2489,6 +2490,17 @@
 ; || !oplay_attack(*,a,b,b)
 
 
+Pattern EC79
+# gf New Pattern (3.3.13)
+
+X.O      connect
+X*.
+O..
+---
+
+:8,C
+
+
 ##############################################
 # First line, one space, cuts and connections.
 ##############################################
@@ -4507,6 +4519,23 @@
 :8,OXe
 
 
+Pattern EB615b
+
+.O?            Prevent monkey jump or other incursion
+.*X
+...
+---
+
+:8,OXed
+
+.O?
+a*X
+...
+---
+
+;omoyo_opposite(a)
+
+
 Pattern EB616
 
 ?o.O?
@@ -6869,6 +6898,7 @@
 
 
 Pattern CB1
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ????????           jump into empty space
 .......?
@@ -6876,10 +6906,11 @@
 .......?
 ????????
 
-:-,OEd,jump_out_helper
+:-,OE,jump_out_helper
 
 
 Pattern CB2
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ??????             jump into empty space
 ?....x
@@ -6887,7 +6918,7 @@
 ?....x
 ??????
 
-:8,OEd,jump_out_helper
+:8,OE,jump_out_helper
 
 
 Pattern CB3
@@ -6903,6 +6934,7 @@
 
 
 Pattern CB4
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ?????          Jump out if starting to get surrounded
 ?...?
@@ -6910,10 +6942,11 @@
 ?...?
 ?.OO?
 
-:8,OEd,jump_out_helper
+:8,Oe,jump_out_helper
 
 
 Pattern CB5
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ?????          jump out
 ?...O
@@ -6921,10 +6954,11 @@
 ??..?
 ?????
 
-:8,OEd,jump_out_helper
+:8,Oe,jump_out_helper
 
 
 Pattern CB6
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ??????         jump out
 ?...Oo
@@ -6932,7 +6966,7 @@
 ??..Oo
 ??????
 
-:8,OEd,jump_out_helper
+:8,Oe,jump_out_helper
 
 
 Pattern CB7
@@ -8178,6 +8212,7 @@
 
 
 Pattern CB258
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ??????          jump! (But not down to second line)
 ?....?
@@ -8185,17 +8220,18 @@
 ?....?
 ?X...?
 
-:8,OXd
+:8,OX
 
 
 Pattern CB259
+# gf Removed d classification (pattern too general). (3.3.13)
 
 ?....           jump!
 oO.*.
 ?....
 ?X.X.
 
-:8,OXd
+:8,OX
 
 
 Pattern CB261
@@ -10587,6 +10623,24 @@
 > replace(a,*)
 
 
+Pattern ED94
+# gf New pattern. (3.3.13)
+
+oo.O?     Significant improvement of eyespace.
+.*.OX     Often sufficient for local life.
+..OXX
+-----
+
+:8,dX
+
+oo.b?
+.*abD
+..cDD
+-----
+
+;!attack(D) && !xplay_defend_both(a,b,c)
+
+
 #####################################################################
 #
 # Center defend/attack patterns
@@ -11495,6 +11549,27 @@
 -----
 
 ;!xmoyo(a)
+
+
+Pattern EJ13b
+
+o......     invade
+o......
+O.X.*.X
+o......
+o......
+-------
+
+:8,Ia
+
+o......
+o......
+a.X.*.X
+o......
+o......
+-------
+
+;!weak(a)
 
 
 Pattern EJ14
Index: patterns/patterns.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.h,v
retrieving revision 1.42
diff -u -r1.42 patterns.h
--- patterns/patterns.h 16 Nov 2002 00:30:25 -0000      1.42
+++ patterns/patterns.h 30 Nov 2002 22:23:26 -0000
@@ -169,7 +169,7 @@
 
 /* Collection of the classes inducing move reasons. */
 #define CLASS_MOVE_REASONS (CLASS_C | CLASS_B | CLASS_b | \
-                            CLASS_e | CLASS_E | CLASS_a | CLASS_d | \
+                            CLASS_e | CLASS_E | CLASS_I | CLASS_a | CLASS_d | \
                            CLASS_J | CLASS_j | CLASS_U | CLASS_T | CLASS_t | \
                             CLASS_W | CLASS_c | CLASS_F)
 
Index: patterns/patterns2.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns2.db,v
retrieving revision 1.48
diff -u -r1.48 patterns2.db
--- patterns/patterns2.db       15 Nov 2002 11:15:42 -0000      1.48
+++ patterns/patterns2.db       30 Nov 2002 22:23:28 -0000
@@ -2977,6 +2977,25 @@
 ;alive(d) && !xplay_defend_both(*,a,b,?,c,a,d)
 
 
+Pattern Sente18
+# gf New pattern. (3.3.13)
+# The reverse followup value is probably often bigger than 5 points.
+
+X..O..
+XOX*..
+......
+------
+
+:8,X,reverse_followup(5)
+
+C..b..
+COX*.a
+......
+------
+
+;omoyo_opposite(a) && alive(b) && alive(C)
+
+
 ########################################################
 #
 # Double threat moves and defense against double threats




reply via email to

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