I have a list which will always contain only 1 turtle in it. It is a patch-only variable and hence when any patch is inspected it appears like best-turtle: [(turtle 1)].
I am reference this particular turtle in another routine using the following code:
ask patches [
set closest-turtle best-turtle
set pcolor scale-color ([color] of closest-turtle + 2) share 0 10
]
I am getting the following error:
OF expected input to be a turtle agentset or link agentset or turtle or link but got the list [(party 0)] instead.
error while patch 4 -2 running OF
called by procedure UPDATE-SUPPORT
called by procedure SETUP
called by Button 'Setup'
It is because of the closest-turtle variable being a list rather than a turtle. SO is there a way to convert a list of 1 to a turtle or some other way to solve this problem.
If you are indeed sure that there will always be one turtle in your list, you can extract it with
first
oritem
:or: