Reputation: 21
I'd like to have each patch display the number of turtles located in that patch. I know I need to use the plabel command, but I cannot figure out how to tell the patch to display the sum of turtles occupying it. Anyone know how to do that?
Upvotes: 2
Views: 3319
Reputation: 1894
You can do that easily by "count turtles-here"
to setup
Clear-all
Create-turtles 50 [move-to patch random 30 random 30]
reset-ticks
end
to set-label
ask patches [
ifelse count turtles-here > 0
[set plabel count turtles-here]
[set plabel ""]
]
end
to go
ask turtles
[rt random 5
fd 0.3]
set-label
tick
end
I have included a working example, but your answer is "set plabel count turtles-here
"
Upvotes: 3