1
我有一隻烏龜的視錐被定義爲5,120。現在,我希望烏龜用與其朋友相同的顏色分配最近的烏龜。我的代碼返回錯誤將烏龜分配給烏龜自己的變量時出錯
this code can't be run by a patch
這是我的代碼
turtles-own [ friend ]
to-report checkForAttraction [ agent ]
if [color] of one-of turtles-on empty-patches = [color] of agent [
set friend min-one-of other turtles-on empty-patches with [color = [color] of agent ] [ distance myself ]
set attracted? 1
]
report actualVelocity
end
誤差在
[color = [color] of agent ]
在第三行顯示出來。這裏有什麼問題?
我其實早在我自己想通了這一點 - 這是驚人的NetLogo怎麼這麼瘋狂的括號內。但是謝謝你! – Gannicus