neighbors1.1 neighbors41.1

neighbors neighbors4 Turtle Command Patch Command

Reports an agentset containing the 8 surrounding patches (neighbors) or 4 surrounding patches (neighbors4).

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