I have the following code, which gives turtles property over patches. Does anyone know how to either create links between the turtle and its owned patches?
Or, even better, to create a line that surrounds the patches that belong to the turtle?
I tried the following code but it gives an error because CREATE-LINKS-WITH expected input to be a turtle agentset but got the agentset (agentset, 25 patches) instead.
It seems that links with patches are not allowed. Any thoughts?
patches-own [
state
patch-owner
]
turtles-own [
property
]
to setup
clear-all
create-turtles 10 [
move-to one-of patches with [not any? turtles-here]
]
setup-patches
set-ownership
end
to setup-patches
ask patches [
let closest-turtle min-one-of turtles [distance myself]
set patch-owner closest-turtle
]
end
to set-ownership
ask turtles [
let my-patches patches with [patch-owner = myself]
create-links-with my-patches
]
]
end