[Top][All Lists]

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

Re: [gnugo-devel] owl_determine_life

From: Gunnar Farneback
Subject: Re: [gnugo-devel] owl_determine_life
Date: Fri, 30 Nov 2001 17:19:01 +0100
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Dan wrote:
> The function owl_determine_life has a parameter called
> does_attack. Gunnar, do you know what this does?

Short answer:
It informs owl_determine_life() whether the caller wants to attack or
defend the eyespaces found.

Long answer:
Consider this position:

|OOOO.X      |OOOO.X
|.X.O.X      |cXbO.X
|.OXO.X      |aOXO.X
+------      +------

The corner O group is critical. X can kill by playing at a. O can live
by playing at b (or c, but that point is inferior to b). The purpose
of owl_determine_life() is to determine the number of eyes and to find
the vital points to attack or defend them. In this position
owl_determine_life() should say min 1 eye, max 2 eyes and return
either a or b as the vital point, depending on whether it was called
from do_owl_attack() or do_owl_defend(). This is implemented through
the parameter does_attack. When it's 1 vital attack points are
generated, when it's 0 vital defense points are generated.

I see the comment above owl_determine_life() is extremely outdated.
Appended is a patch to bring it up to date.


Index: engine/owl.c
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.39
diff -u -r1.39 owl.c
--- engine/owl.c        2001/11/29 14:00:53     1.39
+++ engine/owl.c        2001/11/30 08:08:01
@@ -1854,13 +1854,40 @@
- * This function is invoked when a terminal node is reached. It runs
- * make_domains() and returns twice the number of eyes, counted very
- * pessimistically.
- * 
- * The support of goal is a dragon for which no defensive move is
- * found. If the string is BLACK then eye is owl_black_eye, and if
- * the string is WHITE then eye is owl_white_eye.
+ * This function is invoked from do_owl_attack() and do_owl_defend()
+ * for each node to determine whether the the dragon has sufficient
+ * eye potential to live. It also generates vital moves to attack or
+ * defend the eyes. There are two distinct sources for eyes. The first
+ * is the eyespaces found by make_domains() and evaluated by
+ * compute_eyes_pessimistic(). The second is the lunches found by
+ * owl_find_lunches() and evaluated by sniff_lunch().
+ *
+ * The return value is a pessimistic estimate of the min number of
+ * eyes. If this is 2 or more we should be certain of life.
+ * (Unfortunately this is not 100% reliable. The patterns in
+ * owl_vital_apats.db are used to compensate for this. See
+ * do_owl_attack() and do_owl_defend() for how these are used.)
+ *
+ * More optimistic estimates of the number of eyes are returned in
+ * *probable_min and *probable_max.
+ *
+ * Vital moves to attack or defend eyes are returned in the moves[]
+ * array. Also moves to reduce the uncertainty of the eye estimates
+ * are added to this array, but with smaller move values. The
+ * parameter does_attack determines whether to generate vital attack
+ * moves or vital defense moves.
+ *
+ * The dragon is specified by the information in the owl struct. The
+ * color of the dragon is passed in the color parameter. If color is
+ * BLACK, eye should be owl->black_eye and if color is WHITE, eye
+ * should be owl->white_eye.
+ *
+ * FIXME: Both the color and the eye parameters are redundant since
+ * this information is already provided through the owl struct.
+ *
+ * The parameter komaster is currently unused. It is included to
+ * prepare better handling of ko once the optics code becomes more ko
+ * aware.
 static int

reply via email to

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