Reputation: 45
This time I'm struggling with changing the center of a circle in netlogo. I have tried using layout-circle and create-ordered-turtle but I can't make the circle choose an other coordinate except the middle one.
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
Upvotes: 0
Views: 267
Reputation: 12580
With create-ordered-turtles
, you can do:
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
That is, you need to make sure you're moving all of the turtles to the same place. In your code, they were all going to different random patches before moving.
Upvotes: 3