I'm using perlin noise to generate a 2d map, with ground types and natural resources.
When you start a new game I need to place your town hall as well as your opponents in such a way they are on grassland and near natural resources.
For an oversimplification, I have a 2d array of integers where a block of 0s and a couple 1s would be great for starting but anything lower than a 0 would be bad. How can I isolate a few blocks of what I'm looking for, ideally with a distance threshold so town halls aren't next to each other.
How does civilization do this for example?
An option is to avoid searching for locations and just force them.
You could place all the starting locations a suitable distance away from each other, and for every location, change the local terrain to grassland and add resource nodes nearby if there aren't enough.