Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > nbrhdMoore

nbrhdMoore

Declaration
Parameters
Remarks
Example
See Also

Declaration

void __stdcall nbrhdMoore(
	int range,      	// range of neighbourhood
	int boundaryType	// type of boundary on world
);
Top of page

Parameters

range
Range of Moore neighbourhood.
boundaryType
Type of boundary to impose on world. See Remarks.
Top of page

Remarks

This function is available through the API. It can be called within the model-supplied routine
onSimCreate to set the neighbourhood of each agent to a Moore neighbourhood of range range. This consists of all sites reachable within range steps up, down, or diagonally (forming a square of side 2×range+1 excepting the center cell).

The neighbours are indexed from left to right and top to bottom. For example, if range=1 the neighbour indices of agent a are

012
3a4
567

Boundaries

Boundaries are handled by the boundaryType parameter which may be one of the following:

btPeriodic
All borders wrap around forming a torus.
btEmpty
Agents at the edge have fewer neighbours. Top of page

Example

void __stdcall setNbrhd(double *param) { nbrhdMoore(1,btEmpty); }
Top of page

See Also

onSimCreate, nbrhd1D, nbrhdBlocks, nbrhdCCDM, nbrhdFractal, nbrhdRandom, nbrhdRandomER, nbrhdVonNeumann.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:41pm