Candidate chunks are given scores to determine which one of them should be expanded into. This score takes into account various settings noted below. The iteration is over a square region centered around the chunk for which the calculation is done, and includes the central chunk as well. Distances are calculated as Manhattan distance.
The pseudocode algorithm to determine a chunk's score is as follows:
player = 0
for neighbour in all chunks within enemy_building_influence_radius from chunk:
player += number of player buildings on neighbour
* building_coefficient
* neighbouring_chunk_coefficient^distance(chunk, neighbour)
base = 0
for neighbour in all chunk within friendly_base_influence_radius from chunk:
base += num of enemy bases on neighbour
* other_base_coefficient
* neighbouring_base_chunk_coefficient^distance(chunk, neighbour)
score(chunk) = 1 / (1 + player + base)
{ building_coefficient: double, enabled: boolean, enemy_building_influence_radius: uint32, friendly_base_influence_radius: uint32, max_colliding_tiles_coefficient: double, max_expansion_cooldown: uint32, max_expansion_distance: uint32, min_expansion_cooldown: uint32, neighbouring_base_chunk_coefficient: double, neighbouring_chunk_coefficient: double, other_base_coefficient: double, settler_group_max_size: uint32, settler_group_min_size: uint32 }