I'm trying to have female animal agents select all patches that have no females within a certain radius. Then, from among those patches, I'd like the female to move to the one which has the highest average prey within the same radius. I currently have:
let potential-sites patches with [not any? patches in-radius 2 with [owner-fem != nobody]]
let pot-site-areas [patches in-radius 2] of potential-sites
let pot-site-prey map [mean [prey] of ?] pot-site-areas
let ideal-site max pot-site-prey
But then I realize that I have no way to tell the female which patch to go to, because ideal-site is just a value with no patch coordinates associated with it. Any suggestions on how to link the value to the actual patch? Many thanks!
Use max-one-of, perhaps like this:
let ideal-site max-one-of potential-sites [mean [prey] of patches in-radius 2]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With