NetLogo:如何在 NetLogo 中设置海龟,它们最初占据 pxcor = -15

问题描述 投票:0回答:1

我正在尝试在 NetLogo 中设置我的海龟,以便它们位于

pxcor = -15
左侧的随机位置。这是我现在拥有的代码,但它不起作用:

to setup-turtles
 create-turtles num-turtles
    ask turtles [
     set shape "circle"
     set size .5
    set xcor random-xcor > -15
    set ycor random-ycor
     set color red
     set metabolism 1 + random-float 6 ;; Zero metabolism agents are immortal
     set vision random-float 4
     set wealth random-float 20
     move-to one-of patches with [not any? turtles-here]
   ]
end
netlogo agent-based-modeling
1个回答
0
投票

代替:

set xcor random-xcor > -15

做:

set xcor -15 - random-float (- min-pxcor - 14.5)

我们从 -15 开始,然后我们向左移动一个介于 0 和从 -15 到世界边缘的距离之间的随机量。世界的边缘是0.5过去

min-pxcor
.

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.