gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] endgame tuning


From: pogonyshev
Subject: [gnugo-devel] endgame tuning
Date: Wed, 12 Mar 2003 14:57:14 +0100 (MET)

- endgame tuning
- new autohelper functions in mkpat.c

this patch adds three new patterns, several new autohelper
(pseudo) functions and removes a bad test.

regression delta includes targeted tests only:

./regress.sh . trevorb.tst
170 unexpected PASS!
./regress.sh . trevorc.tst
1120 unexpected PASS!
1130 unexpected PASS!

tests 1120 and 1130 are practically the same.

i had a short conversation with Gunnar on nngs yesterday about the
patterns. the problem was that, depending on situation, EE416 had
three different valuations. he suggested adding three patterns and
i agreed. however, when it turned out that there were even more
than three cases and i decided to add the same pattern for the
other color, i started looking for a better solution. i remembered
the `value' pseudofunction which was only used in read_attack.db
and read_defend.db. so i rewrote the five patterns into two, using
short scripts and `terri' and `reverse_followup' pseudofunctions
in the spirit of `value'.

i think this approach is better, because it
  - makes it easier to take into account move valuation nuances (i
    assume most of us would prefer to write a short script rather
    than add several almost identical patterns)
  - hence makes gnu go stronger: we can provide it better move
    valuation
  - makes patterns not so static (especially Arend and Evan used to
    blame "static knowledge" as far as i remember)
  - values may depend on worm sizes etc.
  - reduces the size of pattern databases (in the long run, if we
    accept it as a general policy)
  - makes gnu go a tiny little bit faster

there are of course some drawbacks:
  - we must stick to the current callback scheme (analyze each
    pattern immediately after it has been matched), otherwise `terri'
    and others won't work
  - patterns are not so clear to a nonprogrammer, but this is not
    too bad since nothing prevents one from writing patterns without
    scripts

one point where dynamic valuation change may become a good strength
boost is shape patterns. we know that they often match when shouldn't
and make gnu go play stupid moves. when in certain positions it looks
risky to eliminate negative shape value completely, we can at least
lower it under some circumstances with a script.

in general, we should probably put some more effort in reducing the
number of false pattern matching. for instance, i only came up with
"lib(A)>2 && same_dragon(A,B) && worm_genus(C)==0" constraint after
some pondering and i'm pretty certain there many patterns out there
which lack similar constraints (i agree it is not ideal, but at least
it is much better than nothing). it is quite difficult to make patterns
general enough, yet match only in proper places, but it is definitely
a worthy goal.

Paul


--- patterns/endgame.db.orig    2003-03-11 02:07:34.000000000 +0200
+++ patterns/endgame.db 2003-03-11 19:01:01.000000000 +0200
@@ -737,6 +737,76 @@ Pattern EE414
 :8,OXed,terri(3)
 
 
+Pattern EE415
+# pp New pattern (3.3.18)
+
+|*O?
+|OXX
+|.OX
++---
+
+:8,X,terri(0.1),reverse_followup(2)
+
+|*A?
+|OXX
+|.OX
+----
+
+;alive(A)
+
+
+Pattern EE416
+# pp New pattern (3.3.18). See trevorc:1120.
+
+
+|OX??
+|.OO?      large to huge corner move
+|..*X
++----
+
+:8,OXe,terri(script),reverse_followup(script)
+
+
+|DB??
+|bCC?
+|.a*A
++----
+
+; lib(A)>2 && same_dragon(A,B) && worm_genus(C)==0
+
+> reverse_followup = 0;
+> if (lib(D) == 2) {
+>   terri = 4;
+>   if (!xplay_defend(*,?,b,C))
+>     reverse_followup = 2 * wormsize(C) + 1;
+> }
+> else
+>   terri = (xplay_defend(*,a,b,C) ? 2 : 3);
+
+
+Pattern EE416b
+# pp New pattern (3.3.18). Same as EE416, but for the other color.
+
+|XO??
+|.XX?      large to huge corner move
+|..*O
++----
+
+:8,OXe,terri(script)
+
+|DB??
+|bCC?
+|.a*A
++----
+
+; lib(A)>2 && same_dragon(A,B) && worm_genus(C)==0
+
+# GNU Go finds followup value itself, so it is not specified here.
+> terri = 4;
+> if (lib(D) > 2)
+>   terri = (oplay_defend(*,a,b,C) ? 2 : 3);
+
+
 # miscellaneous first line moves
 ################################
 
--- patterns/mkpat.c.orig       2003-03-11 16:52:29.000000000 +0200
+++ patterns/mkpat.c    2003-03-11 17:50:02.000000000 +0200
@@ -260,6 +260,7 @@ static struct autohelper_func autohelper
   {"oterri",                   1, 0, 0.01,
       "(whose_territory(OPPOSITE_INFLUENCE(color), %s) == color)"},
   {"genus",                    1, 0, 0.01, "dragon[%s].genus"},
+  {"worm_genus",               1, 0, 0.02, "worm[%s].genus"},
   {"approx_xlib",              1, 0, 0.03,
                "approxlib(%s, OTHER_COLOR(color), MAX_LIBERTIES, NULL)"},
   {"approx_olib",              1, 0, 0.03,
@@ -360,6 +361,14 @@ static struct autohelper_func autohelper
   {"surround_map",             2, 0, 0.01, "surround_map(%s, %s)"},
   {"oracle_threatens",         2, 0, 0.01, "oracle_threatens(%s, %s)"},
   {"value",                    0, 2, 0.0,  "(%s->value)"},
+  {"minvalue",                 0, 2, 0.0,  "(%s->value)"},
+  {"maxvalue",                 0, 2, 0.0,  "(%s->maxvalue)"},
+  {"terri",                    0, 2, 0.0,  "(%s->minterritory)"},
+  {"minterri",                 0, 2, 0.0,  "(%s->minterritory)"},
+  {"maxterri",                 0, 2, 0.0,  "(%s->maxterritory)"},
+  {"shape",                    0, 2, 0.0,  "(%s->shape)"},
+  {"followup",                 0, 2, 0.0,  "(%s->followup)"},
+  {"reverse_followup",         0, 2, 0.0,  "(%s->reverse_followup)"},
   {"adjacent_to_defendable_stone_in_atari", 1, 0, 1.0,
                 "adjacent_to_defendable_stone_in_atari(%s)"}
 };
@@ -1043,9 +1052,12 @@ finish_pattern(char *line)
     }
 
     while (sscanf(p, "%*[, ]%[^,]%n", entry, &n) > 0) {
-      p += n;
+      char special_value[80];
 
-      if (sscanf(entry, "%*[^(](%f)", &v) > 0) {
+      p += n;
+      if (sscanf(entry, "%*[^(](%f)", &v) > 0
+         || (sscanf(entry, "%*[^(](%[^)])", special_value) > 0
+             && !strcmp(special_value, "script"))) {
        const char *corner_unsupported = NULL;
 
        if (strncmp(entry, "value", 5) == 0
@@ -1100,6 +1112,8 @@ finish_pattern(char *line)
        strncpy(helper_fn_names[patno], entry, 79);
        break;
       }
+
+      v = 0.0;
     }
 
     for (p2 = class; *p2; p2++) {
--- regression/trevorc.tst.orig 2003-03-11 02:09:01.000000000 +0200
+++ regression/trevorc.tst      2003-03-11 02:58:48.000000000 +0200
@@ -823,13 +823,14 @@ loadsgf games/trevor/auto/c78.sgf 94
 #? [K10]
 
 
-loadsgf games/trevor/auto/c78.sgf 100
-1410 gg_genmove white
-#? [J4]*
+# J4 allows black to kill with G3 or H2 - removed test /pp
+#loadsgf games/trevor/auto/c78.sgf 100
+#1410 gg_genmove white
+##? [J4]*
 
 
 loadsgf games/trevor/auto/c78.sgf 102
-1420 gg_genmove white 6
+1420 gg_genmove white
 #? [J4]
 
 

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!





reply via email to

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