ABC
ABC

Reputation: 23

Set Turtle to Specific Grid Location - NetLogo

I have seen similar questions but haven't found what I needed yet... Was wondering if anyone knew how to set specific locations for turtles at NetLogo Setup?

Currently tried:

to setup

create-turtles 5

set turtles at-points [[-12 20 ] [-11 19] [-12 18 ] [-18 18 ] [-11 17]]

but they're all showing up at [0 0]

Thanks!

Upvotes: 0

Views: 528

Answers (1)

Matteo
Matteo

Reputation: 2926

This can be done in many ways:

  • You can use setxy in the create-turtles command block. In most models you will see this is used in combination with random-xcor and random-ycor to give each turtle a random location, but you can also use it in any other way.
  • You can use move-to to ask a specific turtle or group of turtles to go to a specific agent (e.g. to a specific patch).
  • You can use sprout to directly ask a specific patch or group of patches to create turtles there.

In any case, I suggest you take a look at the NetLogo Programming Guide and the NetLogo Dictionary

Upvotes: 2

Related Questions