Thursday 15 September 2011

netlogo - Create more than 1 turtles on patchset -



netlogo - Create more than 1 turtles on patchset -

how create more 1 turtles on patchset such no 2 turtles have same center?

number of turtles create defined density.

therefore, require more agents per patch.

eluciadtion: there a set of patches in shape of box in wish fill agents. equivalent distributing agents in room.

this reply distribute turtles on patches create turtles outside box well.

thanks.

assuming patchset means patches.

crt number [setxy random-xcor random-ycor]

gives number of turtles uniformly distributed on patches little chance of having same center. birthday problem floating points.

or if want n turtles uniformly distributed on set of patches p.

repeat n [ask one-of p [ sprout 1 setxy (pxcor + random-float 1 - .5) (pycor + random-float 1 -.5) ] ]

pick random fellow member of set , set turtle on random part of patch

netlogo

No comments:

Post a Comment