检查海龟的x坐标和y坐标是否与补丁相同 [英] Check if turtles have same x-coordinate and y-coordinate as patches
问题描述
我有一个补丁集subtractset
,其中一些补丁上有乌龟.
现在,我希望仅在具有与x-cor
和y-cor
不同的补丁程序上创建乌龟.
注意: 这与下面的代码不同:
distribute-turtles (population * percent) subtractset with[count turtles-here = 0]
,因为这里可能有一只乌龟在贴片上,但贴片的 谢谢.
如果我的问题有歧义,请让我. 补丁具有整数坐标,因此一种方法是检查乌龟坐标是否为整数.
圆形xcor = xcor和圆形ycor = ycor 是真的,只要乌龟以补丁为中心 或者因为海龟可以访问补丁变量 哪个更令我满意,并且可能更快? 您可以将其放在一个过程中. I have a patchset Now, I wish to create turtles on only those patches which have different Note:
This is different from below code: as here a turtle maybe on patch and still have different Thanks.
Please let me if there is some ambiguity in my question. Patches have integer coordinates so one way would be to check if the turtles coordinates are integers.
round xcor = xcor and round ycor = ycor Is true iff the turtle is centered on a patch Or because turtles have access to patch variables Which is more pleasing to my eye and probably faster. You could put it in a procedure.
这篇关于检查海龟的x坐标和y坐标是否与补丁相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!x-cor
和y-cor
仍然不同.
xcor = pxcor and ycor = pycor
To-report centered
Report xcor = pxcor and ycor = pycor
End
subtractset
and some of patches have turtles on it. x-cor
and y-cor
as the patches. distribute-turtles (population * percent) subtractset with[count turtles-here = 0]
x-cor
and y-cor
as the patch. xcor = pxcor and ycor = pycor
To-report centered
Report xcor = pxcor and ycor = pycor
End