Function
pick_variant
(tiles: dict[str, list[Image.Image]], t: str, seed: int, r: int, c: int)
Source from the content-addressed store, hash-verified
| 246 | |
| 247 | |
| 248 | def 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 | |
| 256 | def normalize01(a: np.ndarray) -> np.ndarray: |
Tested by
no test coverage detected