gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Patch: Better valuation of attack threats


From: Inge Wallin
Subject: [gnugo-devel] Patch: Better valuation of attack threats
Date: Mon, 14 Jan 2002 13:04:34 +0100 (MET)

Here is a patch that finally makes the valuation of strategy:17
correct.  Or almost so, at any rate: There is still a small
contribution from shape that doesn't really apply here.

Please note that it doesn't fix strategy:17; it already passed, but
the valuation of the move at N11 was incorrect.

Summary:
 - new function: adjusted_worm_attack_threat_value

        -Inge

================================================================

diff -ur gnugo/engine/value_moves.c gnugo-iw/engine/value_moves.c
--- gnugo/engine/value_moves.c  Sun Jan 13 16:22:58 2002
+++ gnugo-iw/engine/value_moves.c       Mon Jan 14 12:52:56 2002
@@ -32,6 +32,10 @@
 #include "move_reasons.h"
 
 
+static float adjusted_worm_attack_threat_value(int pos, int ww);
+static float adjusted_worm_attack_value(int pos, int ww);
+
+
 /* Test all moves which defend, attack, connect or cut to see if they
  * also attack or defend some other worm.
  *
@@ -990,6 +994,38 @@
 
 
 /*
+ * (pos) is a move that threatens to attack a worm (ww).
+ *
+ * Analyze the value of this threat by playing it out and then find
+ * the value of the attack move that attacks the worm.
+ *
+ * FIXME: Sometimes there can be several attacks on the worm, each with
+ *        different values.  When attack() can return many attack points,
+ *        revisit this function and refine it.
+ */
+
+static float
+adjusted_worm_attack_threat_value(int pos, int ww)
+{
+  int    color;
+  int    aa;
+  float  retval;
+
+  color = OTHER_COLOR(board[ww]);
+  if (!trymove(pos, color, "adjusted_worm_attack_threat_value", ww,
+              NO_MOVE, NO_MOVE)) {
+    gg_assert(0);
+  }
+
+  attack(ww, &aa);
+  retval = adjusted_worm_attack_value(aa, ww);
+  popgo();
+
+  return retval;
+}
+
+
+/*
  * Usually the value of attacking a worm is twice its effective size,
  * but when evaluating certain move reasons we need to adjust this to
  * take effects on neighbors into account, e.g. for an attack_either
@@ -1730,8 +1766,8 @@
        if (move_reason_known(pos, MY_ATARI_ATARI_MOVE, -1))
          break;
 
-       aa_value = adjusted_worm_attack_value(pos, aa);
-       bb_value = adjusted_worm_attack_value(pos, bb);
+       aa_value = adjusted_worm_attack_threat_value(pos, aa);
+       bb_value = adjusted_worm_attack_threat_value(pos, bb);
        this_value = gg_min(aa_value, bb_value);
 
        TRACE("  %1m: %f - either attacks %1m (%f) or attacks %1m (%f)\n",
@@ -1766,8 +1802,8 @@
          break;
 
        if (move_reasons[r].type == ATTACK_EITHER_MOVE) {
-         aa_value = adjusted_worm_attack_value(pos, aa);
-         bb_value = adjusted_worm_attack_value(pos, bb);
+         aa_value = adjusted_worm_attack_threat_value(pos, aa);
+         bb_value = adjusted_worm_attack_threat_value(pos, bb);
          this_value = gg_min(aa_value, bb_value);
 
          TRACE("  %1m: %f - attacks either %1m (%f) or %1m (%f)\n",
diff -ur gnugo/regression/strategy.tst gnugo-iw/regression/strategy.tst
--- gnugo/regression/strategy.tst       Fri Jan 11 18:29:20 2002
+++ gnugo-iw/regression/strategy.tst    Mon Jan 14 12:54:01 2002
@@ -91,11 +91,6 @@
 #CATEGORY=PATTERN_TUNING
 #DESCRIPTION=N11 may not be biggest, but should be found.
 #SEVERITY=2
-#    2.7.179: This can surely be fixed with the addition of a
-#    pattern. After N11, the strings at M12 and N10 cannot both be 
-#    saved. This is not necessarily the biggest move on the board but 
-#    at least this move should be found.
-#
 # incident 165
 loadsgf games/incident165.sgf 108
 17 gg_genmove black
@@ -105,7 +100,7 @@
 #CATEGORY=DYNAMIC_READING
 #DESCRIPTION=Atari is certainly better.
 #SEVERITY=4
-#PREDICESSOR=reading.tst#124
+#PREDECESSOR=reading.tst#124
 # incident 166a
 # E5 is an overplay
 # See reading test 124



reply via email to

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