Print

Print


Given that one of the most common idioms will be 'get my neighbours', then
sparse grids could still be confusing in that the includeOrigin parameter
will exclude other agents at the origin when this perhaps was not expected.
One possible solution would be to have companion methods such as:

For sparse grids (or any future grids where co-located objects are possible):

getNeighborsMaxDistanceOfTarget(Object target, boolean includeOrigin, int
dist, boolean toroidal, IntBag result, IntBag xPos, IntBag yPos)

For single-object-per-location grids:

getNeighborsMaxDistanceOfTarget(Object target, int dist, boolean toroidal,
IntBag result, IntBag xPos, IntBag yPos)

This avoids this includeOrigin ambiguity.

Does that sound useful or over-complicating?

Regards,
Stuart

P.S. Apologies that my Britishness painfully forces me to use the
'neighbour' spelling in non-code text :-) 

On Wed, 15 Aug 2012 02:09:44 +0200, Sean Luke <[log in to unmask]> wrote:

>1. We won't change their semantics -- they'll work as they did before:
either bounded or toroidal.
>2. They'll be officially deprecated.
>3. New versions will have, instead of a "toroidal" boolean parameter, the
following new parameters:
>
>	- mode:	one of Grid2D.BOUNDED, Grid2D.UNBOUNDED, or Grid2D.TOROIDAL
>	- includeOrigin (a boolean), which indicates whether to include the origin
point itself in the neighborhood
>