neighbors: neighbors

Description Usage Arguments Value

Description

Function called by settle.con that identifies all matrix cells within 'radius' number of cells of any already occupied cell. Flexible to the number of prevously "settled" cells. This generates the set of available cells from which subsequently settling agents can choose. Can only work on one occupied cell at a time.

Usage

1
neighbors(i, radius, mat, ...)

Arguments

i

The set of currently occupied cells.

radius

sets how many cells away from the occupied cells should be included in the "neighborhood" (e.g., 1 means the 8 adjoining neighbors, 2 gives the 8 adjoining neighbors plus the 16 cells outside those - 24 total, etc.).

mat

A matrix of the same size as the simulated landscape but with the value of each cell corresponding to it's cell ID.

...

Additional arguments as necessary.

Value

A numeric vector of the matrix cell IDs which are available for selection.


syanco/checkyourself documentation built on Jan. 18, 2021, 4:50 a.m.