gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] thrashing dragons again


From: Arend Bayer
Subject: [gnugo-devel] thrashing dragons again
Date: Sat, 18 Dec 2004 07:31:28 +0100 (CET)


Two changes to the thrashing dragon heuristic:

- We use the thrashing dragon heuristic much more often: Do it even if we
are behind (up to 30 pts), and don't bother to make it dependant on the
move value without the thrashing dragon heuristic. This means we don't
have to run review_move_reasons() twice in the case of a thrashing
dragon. The rational is that we still won't miss an urgent move somewhere
else, as the thrashing dragon moves would have to have higher value
that this urgent moves.
The decision whether we want to use the thrashing dragon heuristics is
now remembered by an explicit variable (which gets passed down from
do_genmove() to estimate_strategical_value()).

- Strategic attack against thrashing dragon now get the same bonus as
connection moves around the dragon. Hence if we have several such moves,
the decision is made according to territorial value, which often guesses
right.

Arend

9 PASS and 3 FAIL:

golife:3        FAIL H5 [E3|E2]
Ok. Caused by connection reading mistake, see new test.
strategy3:141   PASS C7 [C7]
Good. (Papering over owl bug.)
13x13:74        PASS G10 [G10]
Good.
nngs2:440       PASS F17 [B18|C18|E16|E18|F16|F17]
Good.
nngs2:550       PASS M14 [!H19|F19]
Good.
nngs3:580       FAIL A4 [H3|J5|K3|J3]
Very bad. A4 should not get a strategic attack move reason vs C6.
nngs3:1000      FAIL H18 [L17]
Acceptable.
nngs4:960       PASS C8 [D7|E10|C8]
Good. (Papering over owl bug.)
gunnar:46       PASS O11 [O11]
Good.
thrash:10       PASS J15 [J15]
Good.
9x9:250         PASS A2 [A2|C1|C2]
Good. (Owl bug.)
olympiad2004:123 PASS K3 [K3|L3|L1]
Good (Horrible owl misread.)


Total nodes: 1649971673 3078086 12931011
16 PASS
13 FAIL

Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.50
diff -u -p -r1.50 aftermath.c
--- engine/aftermath.c  8 Nov 2004 04:10:02 -0000       1.50
+++ engine/aftermath.c  18 Dec 2004 03:15:10 -0000
@@ -863,7 +863,7 @@ reduced_genmove(int color)
   gg_assert(stackp == 0);
 
   /* Review the move reasons and estimate move values. */
-  if (review_move_reasons(&move, &value, color, 0.0, our_score, NULL))
+  if (review_move_reasons(&move, &value, color, 0.0, our_score, NULL, 0))
     TRACE("Move generation likes %1m with value %f\n", move, value);
   gg_assert(stackp == 0);
 
Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.100
diff -u -p -r1.100 genmove.c
--- engine/genmove.c    7 Dec 2004 04:50:02 -0000       1.100
+++ engine/genmove.c    18 Dec 2004 03:15:10 -0000
@@ -298,6 +298,7 @@ do_genmove(int color, float pure_threat_
   int save_depth;
   int move;
   float dummy_value;
+  int use_thrashing_dragon_heuristics = 0;
 
   if (!value)
     value = &dummy_value;
@@ -419,6 +420,15 @@ do_genmove(int color, float pure_threat_
 
   /* Look for moves to break mirror play by the opponent. */
   break_mirror_go(color);
+
+  /* If we are ahead by 10 points or more, consider a thrashing
+   * dragon dangerous and change its status from DEAD to
+   * UNKNOWN. This may generate a move. Otherwise, pretend there is no
+   * thrashing dragon.
+   */
+  if (!doing_scoring && !limit_search)
+    use_thrashing_dragon_heuristics
+      = revise_thrashing_dragon(color, our_score, -30.0);
   
   /* The general pattern database. */
   shapes(color);
@@ -432,28 +442,12 @@ do_genmove(int color, float pure_threat_
 
   /* Review the move reasons and estimate move values. */
   if (review_move_reasons(&move, value, color, 
-                         pure_threat_value, our_score, allowed_moves))
+                         pure_threat_value, our_score, allowed_moves,
+                         use_thrashing_dragon_heuristics))
     TRACE("Move generation likes %1m with value %f\n", move, *value);
   gg_assert(stackp == 0);
   time_report(1, "review move reasons", NO_MOVE, 1.0);
 
-  /* If we are ahead by 15 points or more, consider a thrashing
-   * dragon dangerous and change its status from DEAD to
-   * UNKNOWN. This may generate a move.
-   */
-  if (*value < 0.4 * our_score && !doing_scoring && !limit_search) {
-    if (revise_thrashing_dragon(color, our_score, 15.0)) {
-      shapes(color);
-      if (!disable_endgame_patterns)
-       endgame_shapes(color);
-      if (review_move_reasons(&move, value, color, pure_threat_value,
-                             our_score, allowed_moves)) {
-       TRACE("Upon reconsideration move generation likes %1m with value %f\n",
-             move, *value); 
-      }
-    }
-    time_report(1, "move reasons with revised thrashing status", NO_MOVE, 1.0);
-  }
 
   /* If the move value is 6 or lower, we look for endgame patterns too. */
   if (*value <= 6.0 && !disable_endgame_patterns && !limit_search) {
@@ -461,7 +455,8 @@ do_genmove(int color, float pure_threat_
     endgame(color);
     gg_assert(stackp == 0);
     if (review_move_reasons(&move, value, color, pure_threat_value, our_score,
-                           allowed_moves))
+                           allowed_moves,
+                           use_thrashing_dragon_heuristics))
       TRACE("Move generation likes %1m with value %f\n", move, *value);
     gg_assert(stackp == 0);
     time_report(1, "endgame", NO_MOVE, 1.0);
@@ -472,17 +467,17 @@ do_genmove(int color, float pure_threat_
    * run shapes and endgame_shapes again. This may turn up a move.
    */
   if (move == PASS_MOVE) {
-    if (revise_thrashing_dragon(color, our_score, 0.0)
-       || revise_semeai(color)) {
+    if (revise_semeai(color)) {
       shapes(color);
       endgame_shapes(color);
       if (review_move_reasons(&move, value, color, pure_threat_value,
-                             our_score, allowed_moves)) {
+                             our_score, allowed_moves,
+                             use_thrashing_dragon_heuristics)) {
        TRACE("Upon reconsideration move generation likes %1m with value %f\n",
              move, *value); 
       }
     }
-    time_report(1, "move reasons with revised semeai or thrashing status",
+    time_report(1, "move reasons with revised semeai status",
                NO_MOVE, 1.0);
   }
 
Index: engine/liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.232
diff -u -p -r1.232 liberty.h
--- engine/liberty.h    20 Nov 2004 18:57:09 -0000      1.232
+++ engine/liberty.h    18 Dec 2004 03:15:10 -0000
@@ -485,7 +485,8 @@ int atari_atari_blunder_size(int color, 
 
 int review_move_reasons(int *move, float *value, int color,
                        float pure_threat_value, float our_score,
-                       int allowed_moves[BOARDMAX]);
+                       int allowed_moves[BOARDMAX],
+                       int use_thrashing_dragon_heuristics);
 void prepare_move_influence_debugging(int pos, int color);
 int fill_liberty(int *move, int color);
 int aftermath_genmove(int color, int do_capture_dead_stones,
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.140
diff -u -p -r1.140 value_moves.c
--- engine/value_moves.c        7 Dec 2004 04:50:02 -0000       1.140
+++ engine/value_moves.c        18 Dec 2004 03:15:12 -0000
@@ -2453,7 +2453,8 @@ estimate_territorial_value(int pos, int 
  * Estimate the strategical value of a move at (pos).
  */
 static void
-estimate_strategical_value(int pos, int color, float our_score)
+estimate_strategical_value(int pos, int color, float our_score,
+                          int use_thrashing_dragon_heuristics)
 {
   int k;
   int l;
@@ -2653,19 +2654,18 @@ estimate_strategical_value(int pos, int 
         * stays dead. If we are ahead, add a safety move here, at most
         * half the margin of victory.
         *
-        * This does not apply if we are doing scoring.
-        *
-        * FIXME: The margin of victory limit is not implemented.
+        * This does only apply if we decided earlier we want to use
+        * thrashing dragon heuristics.
         */
       
-       if (!doing_scoring) {
+       if (use_thrashing_dragon_heuristics) {
          int cc;
          aa = dragon[conn_worm1[move_reasons[r].what]].origin;
          bb = dragon[conn_worm2[move_reasons[r].what]].origin;
          cc = get_last_opponent_move(color);
 
          if (cc != NO_MOVE
-             && dragon[cc].status == DEAD
+             && thrashing_stone[cc]
              && are_neighbor_dragons(aa, cc)
              && are_neighbor_dragons(bb, cc)) {
            if (aa == bb)
@@ -2761,8 +2761,12 @@ estimate_strategical_value(int pos, int 
         * dragon safety alone is not enough. The question is whether
         * the dragon is threatened by the move or not.
         */
-       this_value = 1.8 * soft_cap(dragon[aa].effective_size, 15.0)
-                    * dragon_weakness(aa, 1);
+       if (use_thrashing_dragon_heuristics
+           && thrashing_stone[aa])
+         this_value = 1.7 * dragon[aa].effective_size;
+       else
+         this_value = 1.8 * soft_cap(dragon[aa].effective_size, 15.0)
+                      * dragon_weakness(aa, 1);
 
        /* No strategical attack value is awarded if the dragon at (aa)
         * has an adjacent (friendly) critical dragon, which is not
@@ -2935,7 +2939,7 @@ compare_move_reasons(const void *p1, con
  */
 static float
 value_move_reasons(int pos, int color, float pure_threat_value,
-                  float our_score)
+                  float our_score, int use_thrashing_dragon_heuristics)
 {
   float tot_value;
   float shape_factor;
@@ -2974,7 +2978,8 @@ value_move_reasons(int pos, int color, f
      * strategical value. See connection_value().
      */
     estimate_territorial_value(pos, color, our_score, 0);
-    estimate_strategical_value(pos, color, our_score);
+    estimate_strategical_value(pos, color, our_score,
+                              use_thrashing_dragon_heuristics);
   }
 
   /* Introduction of strategical_weight and territorial_weight, 
@@ -3188,7 +3193,8 @@ value_move_reasons(int pos, int color, f
  * Loop over all possible moves and value the move reasons for each.
  */
 static void
-value_moves(int color, float pure_threat_value, float our_score)
+value_moves(int color, float pure_threat_value, float our_score,
+            int use_thrashing_dragon_heuristics)
 {
   int m, n;
   int pos;
@@ -3201,7 +3207,8 @@ value_moves(int color, float pure_threat
       pos = POS(m, n);
 
       move[pos].value = value_move_reasons(pos, color, 
-                                          pure_threat_value, our_score);
+                                          pure_threat_value, our_score,
+                                          use_thrashing_dragon_heuristics);
       if (move[pos].value == 0.0)
        continue;
       
@@ -3644,7 +3651,8 @@ find_best_move(int *the_move, float *val
 int
 review_move_reasons(int *the_move, float *value, int color,
                    float pure_threat_value, float our_score,
-                   int allowed_moves[BOARDMAX])
+                   int allowed_moves[BOARDMAX],
+                   int use_thrashing_dragon_heuristics)
 {
   int save_verbose;
 
@@ -3682,7 +3690,8 @@ review_move_reasons(int *the_move, float
     list_move_reasons(stderr, NO_MOVE);
 
   /* Evaluate all moves with move reasons. */
-  value_moves(color, pure_threat_value, our_score);
+  value_moves(color, pure_threat_value, our_score,
+             use_thrashing_dragon_heuristics);
   time_report(2, "  value_moves", NO_MOVE, 1.0);
 
   /* Perform point redistribution */
Index: regression/connection.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/connection.tst,v
retrieving revision 1.80
diff -u -p -r1.80 connection.tst
--- regression/connection.tst   6 Dec 2004 23:19:13 -0000       1.80
+++ regression/connection.tst   18 Dec 2004 03:15:12 -0000
@@ -415,6 +415,11 @@ loadsgf games/gunnar/gunnar9.sgf 4
 115 disconnect D10 J7
 #? [1 H7]*
 
+# See also golife:3 and connection:28
+loadsgf games/golife.sgf 30
+116 disconnect H4 H7
+#? [0]
+
 # Report number of nodes visited by the tactical reading
 10000 get_reading_node_counter
 #? [0]&




reply via email to

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