Previous: Board Utilities, Up: Utility Functions
We will only list here a portion of the public functions in influence.c
.
The influence code is invoked through the function compute_influence
(see Influence Usage). It is invoked as follows.
void compute_influence(int color, const char safe_stones[BOARDMAX], const float strength[BOARDMAX], struct influence_data *q, int move, const char *trace_message)
Compute the influence values for both colors. The caller mustResults will be stored in q.
- set up the
board[]
state- mark safe stones with
INFLUENCE_SAFE_STONE
, dead stones with 0- mark stones newly saved by a move with
INFLUENCE_SAVED_STONE
(this is relevant if the influence_data *q is reused to compute a followup value for this move).move
has no effects except toggling debugging. Set it to -1 for no debug output at all (otherwise it will be controlled by the -m command line option). It is assumed thatcolor
is in turn to move. (This affects the barrier patterns (class A, D) and intrusions (class B)). Color
Other functions in influence.c are of the nature of utilities which may be useful throughout the engine. We list the most useful ones here.
void influence_mark_non_territory(int pos, int color)
Called from actions for `t' patterns in barriers.db. Markspos
as not being territory forcolor
.
int whose_territory(const struct influence_data *q, int pos)
Return the color of the territory atpos
. If it's territory for neither color,EMPTY
is returned.
int whose_moyo(const struct influence_data *q, int pos)
Return the color who has a moyo atpos
. If neither color has a moyo there,EMPTY
is returned. The definition of moyo in terms of the influences is totally ad hoc.
int whose_area(const struct influence_data *q, int pos)
Return the color who has dominating influence (“area”) at pos
.
If neither color dominates the influence there, EMPTY is returned.
The definition of area in terms of the influences is totally ad hoc.