If adult-vaccination
is a probability from 0 to 1, you can probabilistically vaccinate adults like so:
ask turtles with [ adult? ] [
if random-float 1 < adult-vaccination [
... ; vaccination code here
]
]
If you want adult-vaccination
to actually determine the fraction of the population that is vaccinated, you can do that like so:
let adults turtles with [ adult? ]
ask n-of round (adult-vaccination * count adults) adults [
...; vaccination code here
]
A few other tidbits:
variable = true
will be the same asvariable
ifvariable
is alwaystrue
orfalse
.- This looks like a perfect opportunity for using breeds. You would have an
adults
breed andchildren
breed. Then you can do things likeask adults [ do stuff ]
and give adults and children different variables, etc.