Previous: False Margins, Up: Eyes


8.11 Functions in optics.c

The public function make_domains() calls the function make_primary_domains() which is static in optics.c. It's purpose is to compute the domains of influence of each color, used in determining eye shapes. Note: the term influence as used here is distinct from the influence in influence.c.

For this algorithm the strings which are not lively are invisible. Ignoring these, the algorithm assigns friendly influence to

  1. every vertex which is occupied by a (lively) friendly stone,
  2. every empty vertex adjoining a (lively) friendly stone,
  3. every empty vertex for which two adjoining vertices (not on the first line) in the (usually 8) surrounding ones have friendly influence, with two CAVEATS explained below.

Thus in the following diagram, `e' would be assigned friendly influence if `a' and `b' have friendly influence, or `a' and `d'. It is not sufficent for `b' and `d' to have friendly influence, because they are not adjoining.

            uabc
             def
             ghi

The constraint that the two adjoining vertices not lie on the first line prevents influence from leaking under a stone on the third line.

The first CAVEAT alluded to above is that even if `a' and `b' have friendly influence, this does not cause `e' to have friendly influence if there is a lively opponent stone at `d'. This constraint prevents influence from leaking past knight's move extensions.

The second CAVEAT is that even if `a' and `b' have friendly influence this does not cause `e' to have influence if there are lively opponent stones at `u' and at `c'. This prevents influence from leaking past nikken tobis (two space jumps).

The corner vertices are handled slightly different.

        +---
        |ab
        |cd

We get friendly influence at `a' if we have friendly influence at `b' or `c' and no lively unfriendly stone at `b', `c' or `d'.

Here are the public functions in optics.c, except some simple access functions used by autohelpers. The statically declared functions are documented in the source code.