How to create cluster patches that do not overlap between them
netlogo
Solution
Here's some sample code:
to make-cluster
loop [
let cluster [patches in-radius (2 + random-float 2)] of one-of patches
if all? (patch-set [neighbors] of cluster) [pcolor = black] [
ask cluster [ set pcolor green ]
stop
]
]
end
If I run it like this:
clear-all repeat 15 [ make-cluster ]
I get this:
Note that none of the clusters touch or overlap.
Problem
I would like to create habitat clusters (e.g. forest patches as in the subject of Marine : Adding patch clusters in a landscape) by controlling the size of clusters and the number of clusters ? For example, I used the code of "plant-migration" : ``` to create-forests ask n-of forest-number patches [ set pcolor green ] ask patches with [pcolor = green] [ let a self let b max list 1 round(random-normal mean-forest-area (mean-forest-area * coef-forest-area)) ask patches with [distance a <= b] [ set pcolor green ] ] end ``` How can I create cluster patches that do not overlap between them ? Thanks in advance