My program is about :
A team of turtles walk around the world to find the best food source and go there.
I have a problem in storing a specific patch (which is the best food location) in my code. I have tried to use patch-here
but I can't store the exact patch that I want
here is the code:
turtles-own
[ myteamset
food-quality-found ;the quality of food that the turtle found
location ;the location of food-quality-found
best-food ;the best food available
location-best-food ;the location of best food
]
patches-own
[ food-quality ;the food source]
Here is the code
foreach teamNumbers [
tn ->
ask turtles with [ teamID = tn ] [
if myteamset != nobody [
ask myteamset [
set food-quality-found food-quality
set location patch-here
;face location
]
if food-quality-found != 0 ;after all turtles found food, thus comparison can be done
[
let x1 max [food-quality-found] of myteamset ; max for group
set location-of-best-food [patch-here] of location ;problem ???
set best-food x1
move-to location-of-best-food ;turtles to go to the best food location
face location-of-best-food ;turtles stay there
]
]
]
This is how my world looks like, purple patch is for nest, others are food.
I need help in storing the value of location-of-best-food
as I can't use patch-here
to store the location. The error is I keep on saving the location where turtles found their food, instead of the location best food.
Thank you for your time.
I have edited my question as I have understood what's @JenB was trying to say (thank you for explaining)