In my model I have agents sprout at random throughout the environment. I'd like to to have a density gradient of these agents.
Is there a neater way to do it than running something like this for different radii?:
ask patch 0 0 [ask n-of 20 turtles in-radius 20 [die]]
You could do something along those lines:
to setup
clear-all
let max-distance max [ distancexy 0 0 ] of patches
ask patches [
if random-float 1.0 > (distancexy 0 0 / max-distance) [
sprout 1
]
]
end
Many variants are possible. The key is to use a combination of random-float
and distancexy 0 0
to get the density you want.