fn flow(scan: &mut Scan, index: usize) -> Kind
Recursively work out the kind of each tile, memoizing values for efficiency.