neighbors1.1 neighbors41.1
neighbors neighbors4

Reports an agentset containing the 8 surrounding patches (neighbors) or 4 surrounding patches (neighbors4), if they exist. If the world is wrapping, the neighbors of a patch along the edge of the world will include the corresponding patches on the opposite edge of the world. If the world is not wrapping, any neighbors outside the boundaries of the world will be excluded from the set. The neighbor set will never include the target patch itself, even if the world only has one row or one column of patches.
show sum [count turtles-here] of neighbors ;; prints the total number of turtles on the eight ;; patches around this turtle or patch show count turtles-on neighbors ;; a shorter way to say the same thing ask neighbors4 [ set pcolor red ] ;; turns the four neighboring patches red
Take me to the full NetLogo Dictionary