1
나는 시력의 원뿔이 5, 120으로 정의 된 거북이가 있습니다. 이제 거북이가 가장 가까운 거북이를 친구와 같은 색으로 지정하고 싶습니다. 내 코드이 내 코드거북이 자체 변수에 거북이를 지정하는 데 오류가 있습니다.
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 ]
에 나타나있는 오류를
this code can't be run by a patch
를 반환합니다. 여기 뭐가 잘못 됐니?
실제로 이전에 내 자신이 알아 낸 - NetLogo 괄호에 대해 너무 미친 어떻게 놀라운. 하지만 고마워! – Gannicus