gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] lunch value


From: Arend Bayer
Subject: [gnugo-devel] lunch value
Date: Fri, 7 Jan 2005 23:36:27 +0100 (CET)


When trying to guess the value of capturing a lunch, the exisiting code
completely ignores the fact that capturing it may turn a half eye closby into a
proper eye etc.

This is a very crude but successful attempt to change this. Regression
breakage shows 6 PASS and 11 FAILs, but analysis shows that in 10 of these
cases the owl reading was actually improved, while I count 5 accidental 
(small node count changes) and one bad change.

Maybe this shows some problem with our testing methods, or just how bad owl
still is (such that correcting one mistake down in the owl tree will more or
less generate random change in the overall owl result).


Arend


owl:6           FAIL 1 B5 [0]
Good.
owl:132         FAIL 0 [(1|2) R4]
Good.
owl:150         FAIL 1 G13 [0]
Accidental.
arb:210         FAIL C8 [D8]
Accidental.
viking:2        PASS E2 [E2]
Accidental.
trevorc:1020    PASS G3 [G2|G3] trevorc:1030    PASS G3 [G3]
Good. (Same owl reading)
trevorc:1440    FAIL F1 [E12|F11]
Good.
13x13:17        FAIL E4 [L5|L3]
Bad.
strategy4:187   FAIL C1 [C4|E4]
Good.
owl1:293        FAIL 1 S6 [0]
Good.
nngs3:400       PASS N13 [N13]
Good.
nngs4:230       FAIL L18 [Q18]
Accidental.
nngs4:870       PASS C3 [C3|C4|D3]
Good.
seki:103        FAIL B2 [B1|A2]
Accidental.
9x9:160         FAIL G6 [E7]
Good.
9x9:260         PASS E6 [E6]
Ok.
kgs:520         PASS R9 [R9]
Good.

Total nodes: 1658834034 3125019 13028025



Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.227
diff -u -p -r1.227 owl.c
--- engine/owl.c        4 Dec 2004 17:26:44 -0000       1.227
+++ engine/owl.c        7 Jan 2005 22:30:05 -0000
@@ -205,6 +205,8 @@ static int owl_estimate_life(struct loca
 static int modify_stupid_eye_vital_point(struct local_owl_data *owl,
                                         int *vital_point,
                                         int is_attack_point);
+static int estimate_lunch_half_eye_bonus(int lunch,
+                       struct half_eye_data half_eye[BOARDMAX]);
 static void owl_mark_dragon(int apos, int bpos,
                            struct local_owl_data *owl,
                            int new_dragons[BOARDMAX]);
@@ -6063,10 +6065,45 @@ sniff_lunch(int lunch, int *min, int *pr
 
   estimate_lunch_eye_value(lunch, min, probable, max, 1);
 
+  if (*min < 2) {
+    int bonus = estimate_lunch_half_eye_bonus(lunch, owl->half_eye);
+    *min += bonus/2;
+    *probable += bonus;
+    *max += (bonus + 1)/2;
+  }
+
   if (*probable < 2)
     eat_lunch_escape_bonus(lunch, min, probable, max, owl);
 }
 
+/* Capturing a lunch can give eyes by turning a false eye into a proper one,
+ * etc. This function returns the likely increase in half eyes
+ * by capturing the string at (lunch).
+ */
+static int
+estimate_lunch_half_eye_bonus(int lunch,
+                             struct half_eye_data half_eye[BOARDMAX])
+{
+  int stones[10];
+  int k;
+  int size = findstones(lunch, 10, stones);
+  int half_eyes = 0;
+
+  ASSERT1(size < 10, lunch);
+
+  for (k = 0; k < size; k++) {
+    int stone = stones[k];
+    int d;
+    for (d = 4; d < 8; d++) {
+      int pos = stone + delta[d];
+      if (is_halfeye(half_eye, pos) || is_false_eye(half_eye, pos))
+       half_eyes++;
+    }
+  }
+  return half_eyes;
+}
+
+
 void
 estimate_lunch_eye_value(int lunch, int *min, int *probable, int *max,
                         int appreciate_one_two_lunches)




reply via email to

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