my question is really trivial but as a beginner in NetLogo I still cannot find my answer..
I have created a patchy surface (available here: basic nlogo code)
to setup clear-all setup-patches reset-ticks end ;create patchy surface to setup-patches ask n-of 5 patches [ set pcolor green ] ask patch 0 0 [ set pcolor yellow ] show max-one-of patches with [pcolor = green] [distancexy 0 0] end
I want to measure the distance between point 0 0 (yellow) and the farthest patch with [pcolor = green].
To measure the distance in NetLogo, I found two possibilities:
- distance shows the coordinates of the farthest green patch (not interest in that)
- distancexy measure the Euclidean distance to my point (what I want)
I tried to create monitors to observe the distance measures using
- max-one-of patches with [pcolor = green] [distancexy 0 0 ] -> returns me patch coordinates and
- [ distance patch 0 0 ] of max-one-of patches [distance myself] -> returns me N/A.
Please, how to include into my code this distance value? If I have to create patches-own variable, how can I include it into my code?
Thank you a lot,