List Info

Thread: number of turtles on them and go there




number of turtles on them and go there
country flaguser name
United States
2008-03-19 00:56:27

Does anybody have any code for asking an individual turtle or breed of
turtles search for a patch with a specified number turtles on it and
going there in the span of one time step?

Should I just create a loop where the turtle moves randomly until it
comes across a patch with the specified number of turtles on it? That
seems like it might make my run-time a lot slower, but that's what I
can think of with my very limited knowledge of NetLogo syntax.

Thanks!

__._,_.___
.

__,_._,___
Re: number of turtles on them and go there
country flaguser name
United States
2008-03-19 07:09:39

Here are two lines of code that you could try:

ask n-of 50 patches[sprout random 5[] ]
ask turtle 0 [let destination_patch one-of patches with[count turtles-here = 2 ] face destination_patch jump distance destination_patch]

The purpose of the first line of code is just to set up a situation
The second line of code does the task in three steps: first, pick the patch with specific number of turtles; second, turn so that heading is in direction of the destination patch; third, move to patch using jump command

On Wed, Mar 19, 2008 at 1:56 AM, benjaminhanowell < benjaminhanowellyahoo.com">benjaminhanowellyahoo.com> wrote:

Does anybody have any code for asking an individual turtle or breed of
turtles search for a patch with a specified number turtles on it and
going there in the span of one time step?

Should I just create a loop where the turtle moves randomly until it
comes across a patch with the specified number of turtles on it? That
seems like it might make my run-time a lot slower, but that's what I
can think of with my very limited knowledge of NetLogo syntax.

Thanks!


__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )