GNU Go Documentation
9.7 Move Generation Functions
The following functions are defined in `move_reasons.c'.
void clear_move_reasons(void)
Initialize move reason data structures.
void add_lunch(int eater, int food)
See if a lunch is already in the list of lunches, otherwise add a new
entry. A lunch is in this context a pair of eater (a dragon) and
food (a worm).
void remove_lunch(int eater, int food)
Remove a lunch from the list of lunches. A lunch is in this context a
pair of eater (a dragon) and food (a worm).
int move_reason_known(int pos, int type, int what)
Check whether a move reason already is recorded for a move.
Negative value for what means only match type.
int attack_move_reason_known(int pos, int what)
Check whether an attack move reason already is recorded for a move.
Negative value for what means only match type.
int defense_move_reason_known(int pos, int what)
Check whether a defense move reason already is recorded for a move.
Negative value for what means only match type.
int owl_defense_move_reason_known(int pos, int what)
Check whether an owl defense move reason already is recorded for a move.
Negative value for what means only match type.
void add_attack_move(int pos, int ww, int code)
Add to the reasons for the move at pos that it attacks the worm
at ww.
void add_defense_move(int pos, int ww, int code)
Add to the reasons for the move at pos that it defends the worm
at ww.
void add_attack_threat_move(int pos, int ww, int code)
Add to the reasons for the move at pos that it threatens to
attack the worm at ww.
void remove_attack_threat_move(int pos, int ww)
Remove an attack threat move reason.
void add_defense_threat_move(int pos, int ww, int code)
Add to the reasons for the move at pos that it defends the worm
at ww.
int get_attack_threats(int pos, int max_strings, int strings[])
Report all, or up to max_strings, strings that are threatened
at pos.
int get_defense_threats(int pos, int max_strings, int strings[])
Report all, or up to max_strings, strings that might be defended
at pos.
int get_biggest_owl_target(int pos)
Report the biggest dragon that is owl-affected (possibily with ko)
by a move at pos.
void add_connection_move(int pos, int dr1, int dr2)
Add to the reasons for the move at pos that it connects the
dragons at dr1 and dr2. Require that the dragons are
distinct.
void add_cut_move(int pos, int dr1, int dr2)
Add to the reasons for the move at pos that it cuts the
dragons at dr1 and dr2. Require that the dragons are
distinct.
void add_antisuji_move(int pos)
Add to the reasons for the move at (pos that it is an anti-suji.
This means that it is a locally inferior move, or for some other reason,
must not be played.
void add_semeai_move(int pos, int dr)
Add to the reasons for the move at pos that it wins the
dragon (friendly or not) at dr in semeai. Since it is
possible that in some semeai one player can kill but the
other can only make seki, it is possible that one dragon
is already alive in seki. Therefore separate move reasons
must be added for the two dragons.
void add_semeai_threat(int pos, int dr)
Add to the reasons for the move at pos that given two
moves in a row a move here can win the dragon (friendly or
not) at dr in semeai. Such a move can be used as a
ko threat, and it is also given some value due to uncertainty
in the counting of liberties.
void add_vital_eye_move(int pos, int eyespace, int color)
Add to the reasons for the move at pos that its the vital
point for the eye space at eyespace of color.
void add_either_move(int pos, int reason1, int target1, int reason2, int target2)
Add to the reasons for the move at pos that it will accomplish
one of two things: either reason1 on target1 or
reason2 on target2. At this time, reason can only
be ATTACK_STRING. More reasons will be implemented in the future.
void add_all_move(int pos, int reason1, int target1, int reason2, int target2)
Add to the reasons for the move at pos that it will accomplish
both of two things: reason1 on target1 and reason2 on
target2. At this time, reason can only be DEFEND_STRING.
More reasons will be implemented in the future.
void add_block_territory_move(int pos)
Add to the reasons for the move at pos that it secures
territory by blocking.
void add_block_territory_move(int pos)
Add to the reasons for the move at pos that it secures
territory by blocking.
void add_expand_territory_move(int pos)
Add to the reasons for the move at pos that it expands
territory.
void add_expand_moyo_move(int pos)
Add to the reasons for the move at pos that it expands moyo.
void add_shape_value(int pos, float value)
This function is called when a shape value for the move at pos
is found. We keep track of the largest positive shape value found, and the
total number of positive contributions, as well as the largest
negative shape value found, and the total number of negative
shape contributions.
void add_worthwhile_threat_move(int pos)
Flag that this move is worthwhile to play as a pure threat move.
float compute_shape_factor(int pos)
This function computes the shape factor, which multiplies the score of
a move. We take the largest positive contribution to shape and add 1
for each additional positive contribution found. Then we take the
largest negative contribution to shape, and add 1 for each additional
negative contribution. The resulting number is raised to the power
1.05. The rationale behind this complicated scheme is that every shape
point is very significant. If two shape contributions with values
(say) 5 and 3 are found, the second contribution should be devalued to
1. Otherwise the engine is too difficult to tune since finding
multiple contributions to shape can cause significant overvaluing of a
move.
void add_strategical_attack_move(int pos, int dr)
Add to the reasons for the move at pos that it attacks
the dragon dr on a strategical level.
void add_strategical_defense_move(int pos, int dr)
Add to the reasons for the move at pos that it defends
the dragon dr on a strategical level.
void add_owl_attack_move(int pos, int dr, int code)
Add to the reasons for the move at pos that the owl
code reports an attack on the dragon dr.
void add_owl_defense_move(int pos, int dr, int code)
Add to the reasons for the move at pos that the owl
code reports a defense of the dragon dr.
void add_owl_attack_threat_move(int pos, int dr, int code)
Add to the reasons for the move at pos that the owl
code reports a move threatening to attack the dragon enemy dr.
That is, if the attacker is given two moves in a row, pos
can be the first move.
void add_owl_uncertain_defense_move(int pos, int dr)
The owl code found the friendly dragon alive, or the unfriendly dragon
dead, and an extra point of attack or defense was found, so this might be a
good place to play.
void add_owl_uncertain_attack_move(int pos, int dr)
The owl code found the opponent dragon alive, or the friendly
dragon dead, but was uncertain, and this move reason propose
an attack or defense which is expected to fail but might succeed.
void add_owl_defense_threat_move(int pos, int dr, int code)
Add to the reasons for the move at pos that the owl
code reports a move threatening to rescue the dragon dr.
That is, if the defender is given two moves in a row, pos
can be the first move.
void add_my_atari_atari_move(int pos, int size)
Add to the reasons for the move at pos that it captures
at least one of a set of worms which individually are tactically
safe (such as a double atari). Only one such move reason is
permitted per move.
void add_your_atari_atari_move(int pos, int size)
Add to the reasons for the move at pos that it stops a
combination attack for the opponent.
void add_owl_prevent_threat_move(int pos, int dr)
Add to the reasons for the move at pos that the owl code reports a
move threatening to defend the dragon enemy dr, and that pos is a
move which attacks the dragon. That is, if the defender is given two
moves in a row, pos can be the first move. Hopefully playing at
pos makes it harder for the dragon to live.
void add_followup_value(int pos, float value)
Add value of followup moves.
void add_reverse_followup_value(int pos, float value)
Add value of inverse followup moves.
int set_minimum_move_value(int pos, float value)
Set a minimum allowed value for the move.
void set_minimum_territorial_value(int pos, float value)
Set a minimum allowed territorial value for the move.
void set_maximum_territorial_value(int pos, float value)
Set a maximum allowed territorial value for the move.
void add_replacement_move(int from, int to)
Add a point redistribution rule, sending the points from from
to to.
void get_saved_worms(int pos, int saved[BOARDMAX])
Find worms rescued by a move at pos.
void get_saved_dragons(int pos, int saved[BOARDMAX])
Find dragons rescued by a move at pos.
void list_move_reasons(int color)
List the move reasons for color.
void discard_redundant_move_reasons(int pos)
This function checks the list of move reasons for redundant move
reasons and marks them accordingly in their status field.
int is_antisuji_move(int pos)
Look through the move reasons to see whether pos is an antisuji move.
int move_connects_strings(int pos, int color)
Count how many distinct strings are (solidly) connected by the move
at pos. Add a bonus for strings with few liberties. Also add
bonus for opponent strings put in atari or removed.
int move_reasons_confirm_safety(int move, int color, int minsize)
Find saved dragons and worms, then call confirm_safety().