| www.delorie.com/gnu/docs/gnugo/gnugo_186.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In this section we list the non-static functions in `owl.c'.
Note that calls to owl_attack and owl_defend should
be made only when stackp==0. If you want to set up a
position, then use the owl code to analyze it, you may call
do_owl_attack and do_owl_defend with stackp>0
but first you must set up the goal and boundary arrays. See
owl_does_defend and owl_substantial for examples.
The reason that we do not try to write a general owl_attack
which works when stackp>0 is that we make use of cached
information in the calls to same_dragon from the (static)
function owl_mark_dragon. This requires the dragon data
to be current, which it is not when stackp>0.
As with the tactical reading code, return codes are WIN, 0,
or KO_A or KO_B if the position is ko. Thus for example
owl_attack()
KO_A if the attack prevails provided attacker is willing to
ignore any ko threat (the attacker makes the first ko capture).
KO_B if attack succeeds provided attacker has a ko threat
which must be answered (the defender makes the first ko capture).
The public functions in `owl.c' are:
void owl_analyze_semeai(int apos, int bpos, int *resulta, int *resultb, int *move, int owl)
Called whenaposandbpospoint to adjacent dragons of the opposite color, both withmatcher_statusDEADorCRITICAL, analyzes the semeai, assuming that the player of theaposdragon moves first.
int owl_attack(int target, int *attack_point, int *certain)
Returns true if a move can be found to attack the dragon attarget, in which case*attack_pointis the recommended move.attack_pointcan be a null pointer if only the result is needed. The array goal marks the extent of the dragon. This must be maintained during reading. Call this function only whenstackp==0; otherwise you can calldo_owl_attackbut you must set up the goal and boundary arrays by hand first.
int owl_threaten_attack(int target, int *attack1, int *attack2)
Returns true if the dragon attargetcan be captured given two moves in a row. The first two moves to capture the dragon are given as*attack1and*attack2.
int owl_defend(int target, int *defense_point, int *certain)
Returns true if a move can be found to defend the dragon attarget, in which case*defense_pointis the recommended move.
defense_point can be a null pointer if the result is not needed.
int owl_threaten_defense(int target, int *defend1, int *defend2)
Returns true if the dragon attargetcan be defended given two moves in a row. The first two moves to defend the dragon are given as*defend1and*defend2.
void owl_reasons(int color)
Add owl reasons. This function should be called once during genmove.
int owl_does_defend(int move, int target)
Use the owl code to determine whether the move atmovemakes the dragon attargetowl safe. This is used to test whether tactical defenses are strategically viable and whether a vital eye point does kill an owl critical dragon. Should be called only whenstackp==0.
int owl_confirm_safety(int move, int target, int *defense_point)
Use the owl code to determine whether the dragon atmoveis owl safe after an own move attarget. This is used to detect blunders. In case the dragon is not safe, it also tries to find a defense point makingtargetsafe in a later move. Should be called only whenstackp==0.
int owl_does_attack(int move, int target)
Use the owl code to determine whether the attack move atShould be called only whenmoveof the dragontargetis effective, i.e. whether it kills the stones.
stackp==0.
int owl_connection_defends(int move, int target1, int target2)
Use the owl code to determine whether connecting the two dragonstarget1andtarget2by playing atmoveresults in a living dragon. Should be called only whenstackp==0.
int owl_lively(int pos)
True unlessposisEMPTYor occupied by a lunch for the goal dragon. Used during make_domains (see the functionis_livelyin `optics.c'). A "lively" worm is one that might be alive, hence cannot be ignored in determining eye spaces.
int owl_substantial(int str)
This function, called whenstackp==0, returns true if capturing the string atstrresults in a live group.
int obvious_false_eye(int pos, int color)
Conservative relative of topological_eye. Essentially the same algorithm is used, but only tactically safe opponent strings on diagonals are considered. This may underestimate the false/half eye status, but it should never be overestimated.
int owl_topological_eye(int pos, int color)
Retrieve topological eye values stored in the half_eye[] array of
the current owl data.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |