gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] owl_determine_life() patch


From: Paul Pogonyshev
Subject: [gnugo-devel] owl_determine_life() patch
Date: Wed, 13 Nov 2002 22:23:00 +0200

this patch looks like a logical bugfix to me. it changes evaluation of 
*eyemax in owl_determine_life() and, hence, the condition to disable playing 
vital moves. regression delta is quite neutral: 4 passes, 3 fails.

./regress.sh . owl_rot.tst
23 unexpected PASS!
125 unexpected PASS!
./regress.sh . manyfaces.tst
9 unexpected FAIL: Correct '!P12', got 'P12'
./regress.sh . strategy3.tst
105 unexpected PASS!
./regress.sh . global.tst
4 unexpected FAIL: Correct 'Q6', got 'F5'
./regress.sh . nngs2.tst
140 unexpected FAIL: Correct 'P5', got 'Q6'
600 unexpected PASS!

it's hard to say anything about the passes and fails. i think they mainly 
reflect behaviour of other parts of owl code.

maybe more important is that the patch saves several percent owl nodes 
(checked for five test files):

owl.tst         22960   22725   -1.0%
owl1.tst        3757     3608   -4.0%
ld_owl          12189   11682   -4.2%
handtalk.tst    36301   34377   -5.3%
neurogo.tst     59036   58468   -1.0%

another side note is that the patch must reduce the number of orientation 
inconsistencies in owl code (and the passes in owl_rot confirm this). that is 
because evaluation of *eyemax currently depends on orientation (on the order 
in which we found eyes) and the patch removes the dependency.

all results are against a cvs before 3.3.12 pre 1.

Paul


Index: owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.117
diff -u -p -r1.117 owl.c
--- owl.c       9 Nov 2002 03:44:33 -0000       1.117
+++ owl.c       13 Nov 2002 20:16:06 -0000
@@ -2740,10 +2740,19 @@ owl_determine_life(struct local_owl_data
   /* now, totalize the eye potential */
   {
     int ne;
-    for (ne = 0; ne < num_eyes - num_lunch; ne++) {
+    for (ne = 0; ne < num_eyes - num_lunch; ne++)
       add_eyevalues(probable_eyes, &eyevalue_list[ne], probable_eyes);
-      *eyemax += max_eyes(probable_eyes);
-    }
+
+    *eyemax += max_eyes(probable_eyes);
+    /* If we have at least two different eyespaces and can create one eye
+     * in sente, we assume there's a chance to create another one. This is
+     * needed because optics code don't know about eyespaces influenting
+     * each other and combination moves (i.e. double threats to create an
+     * eye).
+     */
+    if (num_eyes - num_lunch > 1 && max_eye_threat(probable_eyes) > 1)
+      *eyemax += 1;
+
     for (; ne < num_eyes; ne++)
       add_eyevalues(probable_eyes, &eyevalue_list[ne], probable_eyes);
   }
@@ -2866,7 +2875,7 @@ owl_shapes(struct matched_patterns_list_
 
   sgf_dumptree = save_sgf_dumptree;
   count_variations = save_count_variations;
-}  
+}
 
 
 /* This function contains all the expensive checks for a matched pattern. */
Index: liberty.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/liberty.h,v
retrieving revision 1.129
diff -u -p -r1.129 liberty.h
--- liberty.h   23 Oct 2002 18:32:35 -0000      1.129
+++ liberty.h   13 Nov 2002 20:16:08 -0000
@@ -948,8 +948,10 @@ void find_half_and_false_eyes(int color,
                              char find_mask[BOARDMAX]);
 
 void set_eyevalue(struct eyevalue *e, int a, int b, int c, int d);
+int min_eye_threat(struct eyevalue *e);
 int min_eyes(struct eyevalue *e);
 int max_eyes(struct eyevalue *e);
+int max_eye_threat(struct eyevalue *e);
 void add_eyevalues(struct eyevalue *e1, struct eyevalue *e2,
                   struct eyevalue *sum);
 int eye_move_urgency(struct eyevalue *e);
Index: optics.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v
retrieving revision 1.59
diff -u -p -r1.59 optics.c
--- optics.c    21 Oct 2002 03:31:35 -0000      1.59
+++ optics.c    13 Nov 2002 20:16:13 -0000
@@ -1822,6 +1822,15 @@ set_eyevalue(struct eyevalue *e, int a, 
   e->d = d;
 }
 
+/* Number of eyes if attacker plays first twice (the threat of the first
+ * move by attacker).
+ */
+int
+min_eye_threat(struct eyevalue *e)
+{
+  return e->a;
+}
+
 /* Number of eyes if attacker plays first followed by alternating play. */
 int
 min_eyes(struct eyevalue *e)
@@ -1834,6 +1843,15 @@ int
 max_eyes(struct eyevalue *e)
 {
   return e->c;
+}
+
+/* Number of eyes if defender plays first twice (the threat of the first
+ * move by defender).
+ */
+int
+max_eye_threat(struct eyevalue *e)
+{
+  return e->d;
 }
 
 /* Add the eyevalues *e1 and *e2, leaving the result in *sum. It is




reply via email to

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