gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] strategic bonus for connection moves


From: Arend Bayer
Subject: Re: [gnugo-devel] strategic bonus for connection moves
Date: Thu, 5 Dec 2002 01:01:47 +0100 (CET)

This is hopefully the final revision of my connection value patch.
The patch has 4 FAILs and 3 PASSes (excluding gunnar.tst where s.th.
must have went wrong here). But I assume without this bit, arend_3_12.4b
might introduce dangerous new mistakes (prefering direct owl defense of
a critical dragon over a safe connection to a living dragon). It
reintroduces a bonus for this case, however making it dependent on the
move being a succesful owl defense.

(This is stolen from Gunnar's large patch.)

Similar for cutting moves.

Arend


- strategical bonus for connecting critical dragons reintroduced
- disregard strategic effects on critical dragons unless move is owl defense

strategy:20     PASS Q11 [Q11]          Important
lazarus:4       FAIL T5 [R12|Q12|M8]    almost acceptable
This is bad, but not terribly bad. GG doesn't understand that R12 also
connects the S9 stones out.
trevorb:740     FAIL H10 [!H10]         ok
Trevor: H10 seems acceptable to me. Sure it does not defend E12, but if
we play F12 instead (as GNU Go currently does), black can nicely
enlarge his moyo with J10/K8/J6 or similar.
strategy2:75    PASS Q11 [Q11]          good
strategy4:163   FAIL N8 [O7|P8]         ok
N8 just works.
nngs3:800       FAIL E3 [G4]            bad
(G4 is missing a connection reason here.)
nngs3:1170      PASS B1 [B1]            good, ...
but lucky. GG does not understand B1 is a owl-attack of C5. (The reading
after B1 is funny, as it stops immediately after Black A5. Must be a mistake
in owl_update_goal().)


Index: engine/move_reasons.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/move_reasons.c,v
retrieving revision 1.102
diff -u -p -r1.102 move_reasons.c
--- engine/move_reasons.c       19 Nov 2002 16:32:35 -0000      1.102
+++ engine/move_reasons.c       4 Dec 2002 23:35:47 -0000
@@ -604,7 +604,7 @@ owl_defense_move_reason_known(int pos, i
  * 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 -p -r1.27 move_reasons.h
--- engine/move_reasons.h       19 Nov 2002 16:32:35 -0000      1.27
+++ engine/move_reasons.h       4 Dec 2002 23:35:48 -0000
@@ -193,6 +193,7 @@ int attack_move_reason_known(int pos, in
 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 -p -r1.68 value_moves.c
--- engine/value_moves.c        30 Nov 2002 16:20:42 -0000      1.68
+++ engine/value_moves.c        4 Dec 2002 23:36:00 -0000
@@ -963,6 +963,9 @@ connection_value(int dragona, int dragon
   float terr_val = move[tt].territorial_value;
   float return_value;

+  if (margin > 20.0)
+    margin = 20.0;
+
   /* When scoring, we want to be restrictive with reinforcement moves
    * inside own territory. Thus if both dragons are weakly_alive,
    * alive, strongly alive, or invincible, no bonus is awarded.
@@ -985,7 +988,6 @@ connection_value(int dragona, int dragon
   }

   if (crude_weakness_a == 0.0
-      || dragon[dragona].status == CRITICAL
       || dragon[dragona].status == DEAD)
     return 0.0;
   if (terr_val < 0.0)
@@ -1007,7 +1009,20 @@ connection_value(int dragona, int dragon
                            + terr_val,
                            (float) da->escape_route);

-  {
+  /* Kludge: For a CRITICAL dragon, we use the usual effective
+   * size and give a strategic effect bigger than 2.0 * effective size.
+   * This is to match the "strategic bonus computation" in
+   * estimate_strategical_value(). This prefers connection moves that
+   * owl defend a dragon to other owl defense move.
+   */
+  if (dragon[dragona].status == CRITICAL) {
+    float bonus = (0.2 - 0.3 * crude_weakness_sum) * sizea;
+    /* If ahead, give extra bonus to connections. */
+    if (margin > 0.0 && bonus > 0.0)
+      bonus *= 1.0 + 0.05 * margin;
+    return_value = 2.0 * sizea + bonus;
+  }
+  else {
     float old_burden = 2.0 * crude_weakness_a * soft_cap(sizea, 15.0);

     /* The new burden is the burden of defending new joint dragon; but
@@ -1017,16 +1032,14 @@ connection_value(int dragona, int dragon
                       * sizea / (sizea + sizeb);

     return_value = 1.05 * (old_burden - new_burden);
+    /* If ahead, give extra bonus to connections. */
+    if (margin > 0.0)
+      return_value *= 1.0 + 0.02 * margin;
   }

   if (return_value < 0.0)
     return_value = 0.0;

-  /* If ahead, give extra bonus to connections. */
-  if (margin > 20.0)
-    margin = 20.0;
-  if (margin > 0.0)
-    return_value *= 1.0 + 0.02 * margin;

   return return_value;
 }
@@ -2313,6 +2326,16 @@ estimate_strategical_value(int pos, int
       continue;

     aa = dragons[k];
+
+    /* If this dragon is critical but not attacked/defended by this
+     * move, we ignore the strategic effect.
+     */
+    if (dragon[aa].status == CRITICAL
+       && !owl_move_reason_known(pos, k)) {
+      DEBUG(DEBUG_MOVE_REASONS, "  %1m: 0.0 - disregarding strategic effect on 
%1m (critical dragon)\n",
+           pos, aa);
+      continue;
+    }

     /* If this dragon consists of only one worm and that worm can
      * be tactically captured or defended by this move, we have





reply via email to

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