How a patch to display the number of times that turtles have visited it?
netlogo
Solution
Your solution seems fine. You just need to give patches a `counter` attribute. For example,
patches-own [counter]
to setup
ask n-of 50 patches [set pcolor lime sprout 1]
ask patches [count-visits]
end
to go
ask turtles [move-to one-of patches]
ask patches [count-visits]
end
to count-visits ;; patch proc
if (pcolor = lime) [
if count turtles-here > 0 [
set counter (counter + 1)
]
set plabel counter
]
end
Problem
I would like to show how many times a patch has been visited by turtles after the simulation. ``` ask patches with [pcolor = lime] [ if count turtles-here > 0 [set counter (counter + 1)] set plabel counter ] ``` Something looks like that. Each patch's value will be increased when a turtle visit it. In the end of simulation, each patch will show the different number of times that turtles have visited it. Thanks.