NetLogo Models Library:
Note: If you download the NetLogo application, every model in the Models Library is included.
This is a 3D version of the 2D model Neighborhoods Example This code example shows how to use the basic 2D and 3D neighborhood primitives in a 3D world. These include
neighbors: reports the 26 patches surrounding a patch or turtle
neighbors6: reports the same patches, excluding the ones at the corners
<agentset> in-radius <number>: reports those agents in agentset whose distance from the caller is less than or equal to n.
<agentset> at-points <list>: reports those agents in agentset at the given points relative to the caller, where list is a list of two-element lists.
Although in this example, we only change the color of the reported patches, you can of course do more complicated operations, including assigning that agentset to a variable. This is particularly useful for Cellular Automata models.