MCPcopy Create free account
hub / github.com/Astropulse/hexmap / flood_keep

Function flood_keep

map.py:429–443  ·  view source on GitHub ↗
(mask: np.ndarray, seeds: np.ndarray)

Source from the content-addressed store, hash-verified

427
428
429def flood_keep(mask: np.ndarray, seeds: np.ndarray) -> np.ndarray:
430 rows, cols = mask.shape
431 out = np.zeros_like(mask, dtype=bool)
432 q = deque()
433 ys, xs = np.where(seeds & mask)
434 for r, c in zip(ys.tolist(), xs.tolist()):
435 out[r, c] = True
436 q.append((r, c))
437 while q:
438 r, c = q.popleft()
439 for rr, cc in hex_neighbors(r, c, rows, cols):
440 if mask[rr, cc] and not out[rr, cc]:
441 out[rr, cc] = True
442 q.append((rr, cc))
443 return out
444
445
446def water_break(cfg: Config) -> np.ndarray:

Callers 1

apply_ocean_depthsFunction · 0.85

Calls 1

hex_neighborsFunction · 0.85

Tested by

no test coverage detected