Reputation: 447
I create 100 turtles in Netlogo and I want to locate them only in particular locations corresponding to Building type 1. These locations are the grey patches of the image (Building type 1).
I assigned the Building type 1 to the patches in grey of my shapefile using the GIS extension and the gis:apply-coverage primitive.
Can someone help me to develop a code for assign these turtles only to these grey patches randomly? or what is better only to this Building type 1 of my shape file?.
Upvotes: 0
Views: 344
Reputation: 17678
There's a couple of options depending on the number of buildings (compared to your 100 turtles). This code is untested, but will hopefully get you going in the right direction.
If each building should have no more than 1 turtle, then do this:
ask n-of 100 patches with [type = 1] [sprout turtles 1]
If there are lots of turtles and they can be assigned to any building patch:
create-turtles 100 [ move-to one-of patches with [type = 1] ]
Upvotes: 2