GNU Go Documentation
9.8 Move Valuation Functions
The file `value_moves.c' contains the function
int review_move_reasons(int *the_move, float *val, int color,
float pure_threat_value, float score) which assigns values to all the
moves. The parameter pure_threat_value is the value assigned to a move
which only threatens to capture or kill something. The reason for
playing these is that the move may be effective because we have
misevaluated the dangers or because the opponent misplays.
Apart from this function, the functions in this file are declared
static. However they are so important that we document many of them
here.
static void find_more_attack_and_defense_moves(int color)
Test all moves which defend, attack, connect or cut to see if they
also attack or defend some other worm.
static void find_more_owl_attack_and_defense_moves(int color)
Test certain moves to see whether they (too) can owl attack or
defend an owl critical dragon. Tested moves are
- Strategical attacks or defenses for the dragon.
- Vital eye points for the dragon.
- Tactical attacks or defenses for a part of the dragon.
- Moves connecting the dragon to something else.
static int strategically_sound_defense(int aa, int tt)
It's often bad to run away with a worm that is in a strategically
weak position. This function gives heuristics for determining
whether a move at tt to defend the worm aa is
strategically sound.
static void induce_secondary_move_reasons(int color)
Any move that captures or defends a worm also connects or cuts
the surrounding dragons. Find these secondary move reasons.
We also let an owl attack count as a strategical defense of our
neighbors of the owl attacked dragon. We only do this for
tactically safe dragons, however, because otherwise the effects of
capturing has already been taken into account elsewhere.
static void examine_move_safety(int color)
Examine the strategical and tactical safety of the moves. This is
used to decide whether or not the stone should generate influence
when the move is evaluated. The idea is to avoid overestimating the
value of strategically unsafe defense moves and connections of dead
dragons. This sets the move.move_safety field.
static float dragon_safety(int dr, int ignore_dead_dragons)
An attempt to estimate the safety of a dragon. Safety values are:
- DEAD
- ALIVE
- CRITICAL
- INESSENTIAL
- TACTICALLY DEAD
- WEAK
- WEAKLY ALIVE
- SEKI
- STRONGLY ALIVE
- INVINCIBLE
- INSUBSTANTIAL
static float connection_value(int dragona, int dragonb, int tt, float margin)
Strategical value of connecting (or cutting) the dragon at dragona
to the dragon at dragonb. Notice that this function is assymetric.
This is because connection_value(a, b) is intended to measure the
strategical value on the a dragon from a connection to the b dragon.
The parameter margin is the margin by which we are ahead.
If this exceeds 20 points we use the cautious impact values
which value connections more. This is because we can afford
to waste a move making sure of safety. If the margin is between
0 and 20 points we interpret linearly between the two sets of
impact values. (See `value_moves.c' for more information.)
static float adjusted_worm_attack_value(int pos, int ww)
Usually the value of attacking a worm is twice its effective size,
but when evaluating certain move reasons we need to adjust this to
take effects on neighbors into account, e.g. for an ATTACK_EITHER
move reason. This does not apply to the attack and defense move
reasons, however, because then the neighbors already have separate
attack or defense move reasons (if such apply).
If the worm has an adjacent (friendly) dead dragon we add its
value. At least one of the surrounding dragons must be alive.
If not, the worm must produce an eye of sufficient size, and that
should't be accounted for here. As a guess, we suppose that
a critical dragon is alive for our purpose here.
On the other hand if it has an adjacent critical worm, and
if pos does not defend that worm, we subtract the value of the
worm, since pos may be defended by attacking that worm. We make at
most one adjustment of each type.
static void estimate_territorial_value(int pos, int color, float score)
Estimate the direct territorial value of a move at pos.
static void estimate_strategical_value(int pos, int color, float score)
Estimate the strategical value of a move at pos.
static int compare_move_reasons(const void *p1, const void *p2)
Compare two move reasons, used for sorting before presentation.
static float value_move_reasons(int pos, int color, float pure_threat_value, float score)
Combine the reasons for a move at pos into a simple numerical value.
static void value_moves(int color, float pure_threat_value, float score)
Loop over all possible moves and value the move reasons for each.
static void print_top_moves(void)
Search through all board positions for the 10 highest valued
moves and print them.
static void reevaluate_ko_threats(int ko_move, int color)
This function is called if the biggest move on board was an illegal
ko capture.
static void redistribute_points(void)
Redistribute points. When one move is declared a replacement for
another by a replacement move reason, the move values for the
inferior move are transferred to the replacement.