我怎样才能在我的模型中随机点聚集我的海龟?
How can I clump my turtles at random points in my model?
在我的模型中,我希望能够聚集我的代理,但要更改此聚集的位置。
目前我可以使用
让它们聚集在一起
setxy random 4 random 4
但它位于模拟原点附近 space。我怎样才能改变它,使它们在每个模型的不同点聚集 运行?
谢谢
我喜欢使用询问补丁来做这类事情,但您可以将代码更改为。
手动设置丛的方法
let clump-X random-pxcor
let clump-Y random-pycor
crt 100 ;; or however many you want to make the create-turtles in your code
[
...
setxy (random 4 + clump-X) (random 4 + clump-Y)
]
补丁和发芽方法
ask one-of patches
[
sprout 100
[
set xcor xcor + random 4
set ycor ycor + random 4
]
]
在我的模型中,我希望能够聚集我的代理,但要更改此聚集的位置。
目前我可以使用
让它们聚集在一起setxy random 4 random 4
但它位于模拟原点附近 space。我怎样才能改变它,使它们在每个模型的不同点聚集 运行?
谢谢
我喜欢使用询问补丁来做这类事情,但您可以将代码更改为。
手动设置丛的方法
let clump-X random-pxcor
let clump-Y random-pycor
crt 100 ;; or however many you want to make the create-turtles in your code
[
...
setxy (random 4 + clump-X) (random 4 + clump-Y)
]
补丁和发芽方法
ask one-of patches
[
sprout 100
[
set xcor xcor + random 4
set ycor ycor + random 4
]
]