0
이 오류는 거북이를 목적지로 가져가는 가장 가까운 패치를 결정하려고 할 때 나타납니다.패치로이 코드를 실행할 수 없습니다.
this code can't be run by a patch
error while turtle 0 running DISTANCE
called by procedure GO
called by Button 'go'
이 문제가있는 코드 :
let nearest-patch min-one-of patches in-cone 1 180 [distance dest]
if not any? other turtles-on nearest-patch
[ face nearest-patch
fd 1 ]
전체 코드 :
to go
reset-ticks
ask turtles
[
; going to the center, then goal
if dest = patch 0 0 and distance patch 0 0 < 3
[ repeat 5 [ fd 1 ]
set dest goal ]
; wrapping around and going to the center, then goal
if distance goal < 3
[ repeat 5 [ fd 1 ]
set dest patch 0 0 ]
face dest
let nearest-patch min-one-of patches in-cone 1 180 [distance dest]
if not any? other turtles-on nearest-patch
[ face nearest-patch
fd 1 ]
]
tick
end
도움말?
위 코드를 실행했는데 goal = patch 0 0으로 오류가 발생하지 않았다. –