[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] influence cleanup

From: Arend Bayer
Subject: [gnugo-devel] influence cleanup
Date: Tue, 17 Dec 2002 18:23:37 +0100 (CET)

I've put up the (big) patch at devel.html. The patch description is
appended below.


- rewrite of interface to influence.c

The last step of the influence cleanup.

Every call into the influence module does now explicitly reference the
influence_data it is referring to (well, except from compute_escape_influence).

These are:

(This is done by pre-declaring struct influence_data in liberty.h, so that
other parts of the engine can pass influence_data by reference, but never
access it.)

This makes some code a little more clumsy, e.g.
has to be replaced with
        whose_moyo(&OPPOSITE_INFLUENCE(color), pos),
but I think that is a good thing, because it makes the dependance on
(color) explicit (which will otherwise be the color with which
examine_position got called).

This revealed a couple of inconsistencies. E.g. find_neighbor_dragons
depended on the color. I am pretty sure we don't the fact whether two
dragons are neighbours to depend on whose turn it is.
Also, the use of omoyo() in conn.db was buggy (or at least inconsistent)
with this respect.

They cause a small, mixed regression delta. E.g. in nngs1:31, N16 is now
considered surrounded, because Q11 is now a neighbor. This gives a
strategic defense reason at N14 via pattern CB258 (where Gunnar added a
"is_surrounded" constraint recently).

All code interpreting worm and dragon data for use in the influence code
has been moved out of influence.c into worm.c/dragon.c/value_moves.c where
it belongs. It reades nice there, too.

The computation of move influence, the delta territory counting and the
delta territory cache have been split up in completely separate functions,
making the code a little more explicit. Also, it should now be a lot more
flexible to use, as I have outlined in earlier e-mails.

There territory valuation has changed a little (it doesn't refer to
the initial board state via worm[] anymore, only to board[]). This makes
a few minor inconsistencies go away. E.g. we don't need the
" -1: assumed sacrifice" territory correction for moves inside opponent's
territory anymore.

As a side note, as I noticed while writing the patch, the whole
influence module is now basically an object, with "object" as in an
OO-language, and would probably read nicer there.  But in C it's
already saner than the old code, too.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]