| 1049 | |
| 1050 | |
| 1051 | def save_map_json(cfg: Config, tilemap: np.ndarray, dy: np.ndarray, numbers: np.ndarray, path: str) -> None: |
| 1052 | data = { |
| 1053 | "seed": cfg.seed, |
| 1054 | "rows": cfg.rows, |
| 1055 | "cols": cfg.cols, |
| 1056 | "tile_width": cfg.tile_w, |
| 1057 | "tile_height": cfg.tile_h, |
| 1058 | "step_x": cfg.step_x, |
| 1059 | "row_off_x": cfg.row_off_x, |
| 1060 | "row_step_y": cfg.row_step_y, |
| 1061 | "tiles": tilemap.astype(str).tolist(), |
| 1062 | "dy": dy.astype(int).tolist(), |
| 1063 | "numbers": numbers.astype(int).tolist(), |
| 1064 | } |
| 1065 | Path(path).write_text(json.dumps(data, indent=2), encoding="utf-8") |
| 1066 | print(f"Saved {path}") |
| 1067 | |
| 1068 | |
| 1069 | def _hex_corners(cx: float, cy: float, size: float, orientation: str) -> list[tuple[float, float]]: |