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

Function pick_variant

map.py:248–253  ·  view source on GitHub ↗
(tiles: dict[str, list[Image.Image]], t: str, seed: int, r: int, c: int)

Source from the content-addressed store, hash-verified

246
247
248def pick_variant(tiles: dict[str, list[Image.Image]], t: str, seed: int, r: int, c: int) -> Image.Image:
249 arr = tiles.get(t) or tiles.get("grass") or []
250 if not arr:
251 raise SystemExit("No usable tiles found in Tiles folder.")
252 h = hashlib.blake2b(f"{seed}|{t}|{r}|{c}".encode("utf-8"), digest_size=8).digest()
253 return arr[int.from_bytes(h, "little") % len(arr)]
254
255
256def normalize01(a: np.ndarray) -> np.ndarray:

Callers 1

render_hex_mapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected