2016-04-14 31 views

回答

1

,你可以这样做:

let my-turtle one-of turtles with [xcor = a and ycor = b] 
ask my-turtle [ whatever you want it to do ] 

但乌龟坐标的浮点运算。所以你不应该试图去检查这个值是否等于某个数字。

你怎么知道它是在(a,b)?如果这是因为它满足了一些条件并移动到那里,那么为什么不在满足条件时将它标为你想要的那个?

0

假设的补丁会做(或者,如果每个补丁只有一个)任何龟:

to-report who-at-xy [#x #y] 
    let _candidates [turtles-here] of patch #x #y 
    if (any? _candidates) [ 
    report [who] of one-of _candidates 
    ] 
    report -1 
end 

这就是说,你几乎可以肯定应该有海龟,而不是直接与他们who号来工作。

相关问题