gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] tuning patch


From: Gunnar Farneback
Subject: [gnugo-devel] tuning patch
Date: Thu, 06 Nov 2003 22:50:28 +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 tuning patch solves a number of test cases from the gifu03 test
suite which was recently added. Regression delta:

strategy3:150   PASS Q1 [Q1]
global:16       PASS O10 [O10]
gifu03:204      PASS J19 [J19]
gifu03:301      PASS E2 [E2]
gifu03:302      PASS B6 [C1|B6]
gifu03:305      PASS L11 [!E1]
gifu03:306      PASS B14 [B14]
gifu03:308      PASS L3 [L3]
gifu03:309      PASS J1 [J1]
gifu03:401      PASS K16 [R15|O17|K16]
gifu03:404      PASS S12 [S12]
gifu03:501      PASS Q14 [Q14]
gifu03:505      PASS E8 [E8]

- move_is_marked_unsafe() in move_reasons.h revised
- modify_stupid_eye_vital_point() revised
- eye tuning
- endgame tuning
- owl tuning
- tuning
- test case revised

/Gunnar

Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.117
diff -u -r1.117 move_reasons.c
--- engine/move_reasons.c       18 Jul 2003 18:59:21 -0000      1.117
+++ engine/move_reasons.c       6 Nov 2003 21:42:12 -0000
@@ -63,6 +63,9 @@
 /* Point redistribution */
 int replacement_map[BOARDMAX];
 
+/* The color for which we are evaluating moves. */
+int current_color;
+
 /* Attack threats that are known to be sente locally. */
 static int known_good_attack_threats[BOARDMAX][MAX_ATTACK_THREATS];
 
@@ -592,7 +595,8 @@
 move_is_marked_unsafe(int pos, int what)
 {
   UNUSED(what);
-  return !move[pos].move_safety;
+  return (!move[pos].move_safety
+         && !adjacent_to_nondead_stone(pos, current_color));
 }
 
 /* Check whether a dragon is non-critical. */
Index: engine/move_reasons.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.h,v
retrieving revision 1.35
diff -u -r1.35 move_reasons.h
--- engine/move_reasons.h       18 Jul 2003 18:59:21 -0000      1.35
+++ engine/move_reasons.h       6 Nov 2003 21:42:12 -0000
@@ -177,7 +177,8 @@
 /* Point redistribution */
 extern int replacement_map[BOARDMAX];
 
-
+/* The color for which we are evaluating moves. */
+extern int current_color;
 
 int find_worm(int str);
 int find_dragon(int str);
@@ -199,6 +200,7 @@
                         float strength[BOARDMAX], float *effective_size);
 void mark_changed_string(int affected, char changed_stones[BOARDMAX],
                         float strength[BOARDMAX], char new_status);
+int adjacent_to_nondead_stone(int pos, int color);
 
 /*
  * Local Variables:
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.179
diff -u -r1.179 owl.c
--- engine/owl.c        3 Oct 2003 21:20:58 -0000       1.179
+++ engine/owl.c        6 Nov 2003 21:42:14 -0000
@@ -2762,10 +2762,12 @@
            TRACE("vital point looked stupid, moved it to %1m\n",
                  attack_point);
 
-         owl_add_move(moves, attack_point, value, reason, 1, 0, NO_MOVE,
-                      MAX_MOVES);
-         vital_values[attack_point] = value;
-         eyes_attack_points[num_eyes] = attack_point;
+         if (attack_point != NO_MOVE) {
+           owl_add_move(moves, attack_point, value, reason, 1, 0, NO_MOVE,
+                        MAX_MOVES);
+           vital_values[attack_point] = value;
+           eyes_attack_points[num_eyes] = attack_point;
+         }
        }
 
        /* The reason for the last set of tests is that we don't
@@ -2815,9 +2817,11 @@
            TRACE("vital point looked stupid, moved it to %1m\n",
                  defense_point);
 
-         owl_add_move(moves, defense_point, value, reason, 1, 0, NO_MOVE,
-                      MAX_MOVES);
-         vital_values[defense_point] = value;
+         if (defense_point != NO_MOVE) {
+           owl_add_move(moves, defense_point, value, reason, 1, 0, NO_MOVE,
+                        MAX_MOVES);
+           vital_values[defense_point] = value;
+         }
        }
       }
       num_eyes++;
@@ -3002,6 +3006,18 @@
  * .XOO|
  * .XXX|
  *
+ * Case 3.
+ *
+ * Playing into a snapback is usually not an effective way to destroy
+ * an eye.
+ *
+ * XOOO|
+ * XOXX|
+ * XXO.|
+ * .XXO|
+ * ....|
+ *
+ * This function changes the attack point to NO_MOVE (i.e. removes it).
  */
 static int
 modify_stupid_eye_vital_point(struct local_owl_data *owl, int *vital_point,
@@ -3010,6 +3026,7 @@
   int up;
   int right;
   int k;
+  int libs[2];
 
   /* Case 1. */
   for (k = 0; k < 4; k++) {
@@ -3047,7 +3064,16 @@
       }
     }
   }
-  
+
+  /* Case 3. */
+  if (is_attack_point
+      && does_capture_something(*vital_point, OTHER_COLOR(owl->color))
+      && accuratelib(*vital_point, OTHER_COLOR(owl->color), 2, libs) == 1
+      && !attack(libs[0], NULL)) {
+    *vital_point = NO_MOVE;
+    return 1;
+  }
+
   return 0;
 }
 
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.110
diff -u -r1.110 value_moves.c
--- engine/value_moves.c        30 Oct 2003 01:35:06 -0000      1.110
+++ engine/value_moves.c        6 Nov 2003 21:42:16 -0000
@@ -1298,7 +1298,7 @@
  * FIXME: Move this somewhere more generally accessible, probably
  *        utils.c
  */
-static int
+int
 adjacent_to_nondead_stone(int pos, int color)
 {
   int k;
@@ -3238,6 +3238,8 @@
                    int allowed_moves[BOARDMAX])
 {
   int save_verbose;
+
+  current_color = color;
   
   start_timer(2);
   find_more_attack_and_defense_moves(color);
Index: patterns/endgame.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/endgame.db,v
retrieving revision 1.55
diff -u -r1.55 endgame.db
--- patterns/endgame.db 20 Aug 2003 12:38:49 -0000      1.55
+++ patterns/endgame.db 6 Nov 2003 21:42:18 -0000
@@ -890,12 +890,14 @@
 #    We certainly can and should add patterns to deal with the case
 #    that there is more space below, when it very likely is sente,
 #    unless such patterns already exist in the EB class.
+# gf Actually this pattern doesn't even guarantee a single point, see
+#    gifu03:204. Removed fixed territorial value. (3.5.3)
 
 |.O?      endgame move
 |.*X      2.5 points gote
 |..x
 
-:8,OXe,terri(2.5)
+:8,OXe
 
 
 Pattern EE802
Index: patterns/eyes.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/eyes.db,v
retrieving revision 1.42
diff -u -r1.42 eyes.db
--- patterns/eyes.db    30 Oct 2003 01:37:52 -0000      1.42
+++ patterns/eyes.db    6 Nov 2003 21:42:19 -0000
@@ -2010,6 +2010,20 @@
 :1122
 
 
+Pattern 6005
+
+$X>.*x
+
+:1122
+
+
+Pattern 6006
+
+$X..Xx
+
+:1112
+
+
 Pattern 6011
 
 xxxxxx
Index: patterns/owl_attackpats.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/owl_attackpats.db,v
retrieving revision 1.95
diff -u -r1.95 owl_attackpats.db
--- patterns/owl_attackpats.db  24 Oct 2003 09:32:51 -0000      1.95
+++ patterns/owl_attackpats.db  6 Nov 2003 21:42:21 -0000
@@ -579,6 +579,24 @@
 :8,-,value(56)
 
 
+Pattern A208d
+# gf New pattern. (3.5.3)
+
+O.X
+.*Y
+.oo
+---
+
+:8,-,value(56)
+
+OaX
+.*Y
+.oo
+---
+
+;!oplay_attack(*,a,*)
+
+
 Pattern A209
 
 ?Ooo
Index: patterns/owl_defendpats.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/owl_defendpats.db,v
retrieving revision 1.104
diff -u -r1.104 owl_defendpats.db
--- patterns/owl_defendpats.db  3 Oct 2003 21:20:03 -0000       1.104
+++ patterns/owl_defendpats.db  6 Nov 2003 21:42:21 -0000
@@ -2558,6 +2558,7 @@
 
 Pattern D642
 # tm New Pattern (3.1.22) (see trevord:910)
+# gf Revised constraint. (3.5.3)
 
 X*O?     Extend side eye-space in sente
 ?..o
@@ -2570,7 +2571,7 @@
 ----
 
 ;!obvious_false_oeye(a)
-;&& oplay_attack(*,b,C)
+;&& oplay_attack(*,b,C) && !attack(C)
 
 
 Pattern D643
@@ -6678,6 +6679,20 @@
 
 ; owl_escape_value(d) > 0
 ; && oplay_attack_either(*,a,b,c,d,B,c) && oplay_connect(*,a,b,c,d,?,A,C)
+
+
+Pattern D1391
+# gf New pattern. (3.5.3)
+
+.O*O       connect out
+OXX.
+
+:8,-,value(80)
+
+bO*a
+dCC.
+
+;owl_escape_value(a) > 0 && oplay_attack(*,b,C) && !xplay_connect(*,a,d)
 
 
 #########################################################
Index: patterns/patterns.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v
retrieving revision 1.116
diff -u -r1.116 patterns.db
--- patterns/patterns.db        4 Nov 2003 10:05:08 -0000       1.116
+++ patterns/patterns.db        6 Nov 2003 21:42:24 -0000
@@ -294,6 +294,22 @@
 ; oplay_attack_either(*,A,B)
 
 
+Pattern CC13b
+# gf New pattern. (3.5.3)
+
+O?        cut!
+*X
+XO
+
+:8,e
+
+a?
+*X
+XO
+
+;alive(a)
+
+
 Pattern CC14
 # This connection is bad shape. Should have a helper to verify
 # that it's necessary.
@@ -3105,16 +3121,18 @@
 
 
 Pattern CS16
+# gf Revised constraint. (3.5.3)
+# See gifu03:308.
 
 ?O.x
 X*.X
 
 :8,OXa
 
-?O.x
-A*.B
+?c.x
+A*dB
 
-;!same_dragon(A,B)
+;!same_dragon(A,B) && (weak(c) || xplay_connect(*,d,A,B))
 
 
 Pattern CS17
@@ -8199,18 +8217,19 @@
 Pattern CB239
 # db added (3.3.3)
 # see nngs1:50
+# gf Revised to avoid bad shape. Constraint revised. (3.5.3)
 
-..?       connect to reinforce and attack
+..x       connect to reinforce and attack
 O*O
 ?X?
 
-:8,OXeda
+:8,Xeda
 
-..?
+..x
 a*b
 ?X?
 
-; !same_dragon(a,b)
+; !same_dragon(a,b) && (alive(a) || alive(b))
 
 
 Pattern CB241c
@@ -10845,6 +10864,29 @@
 
 ;!oplay_connect(a,b,c,d,?,g,?,h,e,f)
 > replace(a,*)
+
+
+Pattern ED96
+# gf New pattern. (3.5.3)
+# See gifu03:401
+
+........
+x..O.*.X
+x.......
+........
+........
+--------
+
+:8,OXeda
+
+........
+c..a.*.B
+d.......
+........
+........
+--------
+
+;weak(a) && weak(B) && x_somewhere(c,d)
 
 
 #####################################################################
Index: patterns/patterns2.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns2.db,v
retrieving revision 1.66
diff -u -r1.66 patterns2.db
--- patterns/patterns2.db       4 Nov 2003 10:05:08 -0000       1.66
+++ patterns/patterns2.db       6 Nov 2003 21:42:25 -0000
@@ -2710,6 +2710,23 @@
 ;oplay_attack_either(*,A,B) && !safe_omove(*)
 
 
+Pattern Shape87
+# gf New pattern. (3.5.3)
+# gf See gifu03:501
+
+.OXx       usually better to extend than atari in cross cut
+.XO.
+.*..
+
+:8,sX,shape(-1)
+
+.aXx
+.Cb.
+.*..
+
+;!dead(a) && !dead(b) && weak(a) && weak(b) && oplay_disconnect(*,a,b)
+
+
 ###########################
 #
 # Followup moves. 
Index: regression/gifu03.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/gifu03.tst,v
retrieving revision 1.3
diff -u -r1.3 gifu03.tst
--- regression/gifu03.tst       5 Nov 2003 19:05:17 -0000       1.3
+++ regression/gifu03.tst       6 Nov 2003 21:42:25 -0000
@@ -79,10 +79,10 @@
 301 reg_genmove black
 #? [E2]*
 
-# C1 suffices to live.
+# C1 suffices to live, as does B6.
 loadsgf games/cgf2003/GnuGo-GoInt.sgf 59
 302 reg_genmove black
-#? [C1]*
+#? [C1|B6]*
 
 # P18 is clearly superior to Q18.
 loadsgf games/cgf2003/GnuGo-GoInt.sgf 69




reply via email to

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