How to sprout 1 turtle in a patch group

If I assign a value to each patch where most patches will share the same value with this attribute, is it possible to sprout only one turtle inside this group of patches? Where will each patch group have only 1 turtle? What will be the syntax of this kind?

It doesn’t matter which patch of the group the turtle gets if this group of patches has only one turtle associated with it.

+4
source share
1 answer

Of course. It’s just that these patches will be part of the temporary group using the let command as follows:

let targetedGroup patches with [someValue = true]

Then just ask a certain number of these patches to do something using n-of:

ask n-of 1 targetedGroup [
    sprout 1 [
        set color blue]]

* : , , . ifelse, , .

+1

Source: https://habr.com/ru/post/1657229/


All Articles