如何在netlogo中更改圆圈的中心?

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

这次我正在努力改变netlogo中的圆心。我尝试过使用layout-circle和create-ordered-turtle,但我不能让圆圈选择除中间坐标之外的其他坐标。

to setup-food
  set-default-shape turtles "dot"

repeat num-food
  [patch-at random-pxcor random-pycor [cro 10 [fd radius set color blue]]]

 ;that was my first attempt
 ;now for the second one  

layout-circle turtles radius 
repeat num-food 
[ setxy random-pxcor random-pycor
  foreach range 25 [y -> ask turtle y
[ foreach range (24 - y) [x -> create-link-with turtle (x + (1 + y))]]]
 ]
end
netlogo circle
1个回答
3
投票

使用create-ordered-turtles,您可以:

to setup-food
  set-default-shape turtles "dot"
  repeat num-food [
    let center one-of patches
    cro 10 [
      move-to center
      fd radius
      set color blue
    ]
  ]
end

也就是说,您需要确保将所有海龟移动到同一个地方。在您的代码中,他们在移动之前都会使用不同的随机补丁。

© www.soinside.com 2019 - 2024. All rights reserved.