Detect closed compartments by flood-filling the map border across every
non-wall tile. Tiles the fill cannot reach are enclosed; their connected
components are the compartments. This is the geometric basis for compartment
quality, dead-zone detection and "defenses behind walls" scoring.
Walls are the only barrier (buildings are not), matching how walls define
regions in Clash of Clans. Cost is O(grid tiles).
Detect closed compartments by flood-filling the map border across every non-wall tile. Tiles the fill cannot reach are enclosed; their connected components are the compartments. This is the geometric basis for compartment quality, dead-zone detection and "defenses behind walls" scoring.
Walls are the only barrier (buildings are not), matching how walls define regions in Clash of Clans. Cost is O(grid tiles).