| www.delorie.com/gnu/docs/gnugo/gnugo_126.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The array struct dragon_data dragon[MAX_BOARD]
collects information about the dragons. We will give definitions of the
various fields. Each field has constant value at each vertex of the
dragon.
struct dragon_data {
int color;
int id;
int origin;
int size;
float effective_size;
int status;
int owl_threat_status;
int owl_status;
int owl_attack_point;
int owl_attack_code;
int owl_attack_certain;
int owl_second_attack_point;
int owl_defense_point;
int owl_defense_code;
int owl_defense_certain;
int owl_second_defense_point;
int matcher_status;
};
extern struct dragon_data dragon[BOARDMAX];
|
Other fields attached to the dragon are contained in the dragon_data2
struct array.
struct dragon_data2 {
int origin;
int adjacent[MAX_NEIGHBOR_DRAGONS];
int neighbors;
int hostile_neighbors;
int moyo;
int safety;
int escape_route;
int genus;
int heyes;
int heye;
int lunch;
int semeai;
int semeai_margin_of_safety;
};
extern struct dragon_data2 *dragon2;
|
The difference between the two arrays is that the dragon array
is indexed by the board, and there is a copy of the dragon data
at every stone in the dragon, while there is only one copy of
the dragon2 data. The dragons are numbered, and the id field
of the dragon is a key into the dragon2 array. Two macros DRAGON
and DRAGON2 are provided for gaining access to the two arrays.
#define DRAGON2(pos) dragon2[dragon[pos].id] #define DRAGON(d) dragon[dragon2[d].origin] |
Thus if you know the position pos of a stone in the dragon
you can access the dragon array directly, for example accessing the
origin with dragon[pos].origin. However if you need a field
from the dragon2 array, you can access it using the DRAGON2 macro,
for example you can access its neighor dragons by
for (k = 0; k < DRAGON2(pos).neighbors; k++) {
int d = DRAGON2(pos).adjacent[k];
int apos = dragon2[d].origin;
do_something(apos);
}
|
Similarly if you know the dragon number (which is dragon[pos].id)
then you can access the dragon2 array directly, or you can
access the dragon array using the DRAGON macro.
Here are the definitions of each field in the dragon arrray.
color
For strings, this isBLACKorWHITE. For caves, it isBLACK_BORDER,WHITE_BORDERorGRAY_BORDER. The meaning of these concepts is the same as for worms.
id
The dragon number. This is a key into the dragon2 array.
origin
The origin of the dragon is a unique particular vertex of the dragon, useful for determining when two vertices belong to the same dragon. Before amalgamation the worm origins are copied to the dragon origins. Amalgamation of two dragons amounts to changing the origin of one.
size
This is the cardinality of the dragon.
effective_size
The sum of the effective sizes of the constituent worms.
Remembering that vertices equidistant between two or more worms are
counted fractionally in worm.effective_size, this equals the
cardinality of the dragon plus the number of empty vertices which are
nearer this dragon than any other.
genus
The genus of a nonempty dragon consists of the number of distinct adjacent caves whose bordercolor is the color of the dragon, minus the number of false eyes found. The genus is a computable approximation to the number of eyes a dragon has.
escape_route
This is a measure of the escape potential of the dragon. If
dragon.escape_route is large, GNU Go believes that the
dragon can escape, so finding two eyes locally becomes less
urgent. Further documentation may be found else where
(see section 16.8 Escape).
status
An attempt is made to classify the dragons asALIVE,DEAD,CRITICALorUNKNOWN. TheCRITICALclassification means that the fate of the dragon depends on who moves first in the area. The exact definition is in the functioncompute_dragon_status(). If the dragon is found to be surrounded, the status isDEADif it has less than 1.5 eyes or if the reading code determines that it can be killed,ALIVEif it has 2 or more eyes, andCRITICALif it has 1.5 eyes. A lunch generally counts as a half eye in these calculations. If it has less than 2 eyes but seems possibly able to escape, the status may beUNKNOWN.
owl_status
This is a classification similar todragon.status, but based on the life and death reading in `owl.c'. The owl code (see section 15.1 The Owl Code) is only run on dragons with dragon.escape_route>5 and dragon2.moyo>10. If these conditions are not met, the owl status isUNCHECKED. Ifowl_attack()determines that the dragon cannot be attacked, it is classified asALIVE. Otherwise,owl_defend()is run, and if it can be defended it is classified asCRITICAL, and if not, asDEAD.
owl_attack_code
If the owl code finds that the dragon can be attacked, this is the attack code. It may beWIN,KO_A,KO_B, or (if the dragon cannot be attacked) 0.
owl_attack_point
If the owl code finds that the dragon can be attacked, this is the point of attack.
owl_attack_certain
The functionowl_attack, which is used to setowl_attack_codeandowl_attack_point, is given an upper bound ofowl_node_limitin the number of nodes it is allowed to generate. If this is exceeded the result is considered uncertain and this flag is set.
owl_second_attack_point
Under certain circumstances the owl functionowl_threaten_attackis asked if the dragon can be killed with two moves in a row. If two such killing moves are found, they are cached inowl_attacki_point(owl_second_attack_point.
owl_defense_code
If the owl code finds that the dragon can be defended, this is the defense code (WIN,KO_A,KO_B); otherwise it is 0.
owl_defense_point
If the owl code finds that the dragon can be defended, this is the move.
owl_defense_certain
owl_second_defense_point
Similar to owl_attack_certain and
owl_second_attack_point.
matcher_status
This is the status used by the pattern matcher. Ifowl_statusis available (notUNCHECKED) this is used. Otherwise, we use thestatusfield, except that we upgradeDEADtoUNKNOWN.
Here are definitions of each field in the dragon2 array.
origin
Duplicates the origin field from the dragon array.
adjacent[MAX_NEIGHBOR_DRAGONS]
An array of adjacent dragons.
neighbors
The number of adjacent dragons.
hostile_neighbors
The number of adjacent dragons of the opposite color.
moyo
Size of the surrounding influence moyo. Computed by
compute_surrounding_moyo_sizes(), calling the influence code.
safety
This is a finer measure of dragon safety thanmatcher_status. In addition to the valuesALIVE,DEADandCRITICALit can take the valuesINESSENTIAL,TACTICALLY_DEAD,WEAK,WEAKLY_ALIVE,ALIVE_IN_SEKI,STRONGLY_ALIVEandINVINCIBLE.
escape_route
A measure of the escape potential of the dragon. Further documentation may be found elsewhere (see section 16.8 Escape).
genus
The "genus" of a nonempty dragon consists of the number of distinct adjacent caves whose bordercolor is the color of the dragon, minus the number of false eyes found. The genus is a computable approximation to the number of eyes a dragon has.
heyes
This is the number of half eyes the dragon has. A "half eye" is a pattern where an eye may or may not materialize, depending on who moves first.
heye
If any half eyes are found, this field points to a move which will create an eye.
lunch
If nonzero, this field points to the location of a boundary worm which can be easily capture. In contrast with the worm version of this parameter we exclude strings which cannot be saved.
semeai
True if the dragon is part of a semeai.
semeai_margin_of_safety
Small if the semeai is close. Currently not reliable.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |