Next: Permeability, Previous: The Influence Core, Up: Influence
Let (m, n)
be the coordinates of the influence source and
(i, j)
the coordinates of a an intersection being visited
during propagation, using the same notation as in the
accumulate_influence()
function. Influence is now propagated to
its eight closest neighbors, including the diagonal ones,
according to the follow scheme:
For each of the eight directions (di, dj)
, do:
di*(i-m) + dj*(j-n)
between the vectors (di,dj)
and (i,j) - (m,n)
(i+di, j+dj)
is outside the board or occupied we
also continue with the next direction.
(i, j)
. The influence
propagated to (i+di, j+dj)
from this intersection is given by
P*(1/A)*D*S
, where the three different kinds of damping are:
(di,dj)
and (i,j) - (m,n)
. The idea is to
stop influence from "bending" around an interfering stone and
get a continuous behavior at the right angle cutoff. The
choice of the squared cosine for this purpose is rather
arbitrary, but has the advantage that it can be expressed as a
rational function of `m', `n', `i', `j',
`di', and `dj', without involving any trigonometric or
square root computations. When we are visiting the influence
source we let by convention this factor be one.
Influence is typically contributed from up to three neighbors "between" this intersection and the influence source. These values are simply added together. As pointed out before, all contributions will automatically have been made before the intersection itself is visited.
When the total influence for the whole board is computed by
compute_influence()
, accumulate_influence()
is
called once for each influence source. These invocations are
totally independent and the influence contributions from the
different sources are added together.