sprout

 

sprout is a patch-only primitive that allows us to ask patches to create new turtles. It must be used within an ask patches [...] context. For example, if we wanted to create a model in which each patch sprouted a flower once it was watered enough, we would write the following code:

ask patches [
    if water-level > 10 [
        sprout 1 [
            set shape "flower"
            set color yellow
            set size 0.1
        ]
    ]
]

Things to keep in mind when using sprout:

In the model example below, we have an empty garden and a farmer. Our farmer moves around randomly and fertilizes each patch. When a patch is fertilized, its pcolor turns into a lighter brown. Once a patch reaches a certain level of fertilization, it sprouts a new plant. If the farmer fertilizes a patch that already has a plant there, the fertilizer helps the plant grow.

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the sprout primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Published NetLogo models that use the sprout primitive:
 
 
Similar primitives:
hatch

Makes a turtle make any number of new turtles that are identical to itself.

Read more
create-turtles

Creates turtles with random colors and headings at the center of the world.

Read more
die

Removes a turtle or link from the world.

Read more
ask

Asks agents to do things.

Read more
 
Learn another primitive: