# Task 13: reikhelm-viz Renderer **Depends on:** Task 5, Task 12 ## Context Files - `.dev/2026-05-28-procgen-map-core/spec/design.md` — §6 (viz crate), §3 (`Map` contract — renderer reads data only). - `reikhelm-core/src/map.rs` — `Map`, `Tile` (Task 5). - `reikhelm-core/src/recipes/dungeon.rs` — `dungeon()`, `DungeonConfig` (Task 12). - `reikhelm-core/src/pass.rs` — `Pipeline::run` / `run_with_snapshots` (Task 6). - `reikhelm-viz/Cargo.toml` — `macroquad` dependency (Task 1). ## Files - Modify: `reikhelm-viz/src/main.rs` — macroquad window rendering a `Map`. ## What to Build The interactive renderer (spec §6). A macroquad binary that builds a dungeon from the `dungeon` recipe at a fixed `DungeonConfig`, then each frame draws one colored rectangle per cell, colored by `Tile` (e.g. `Wall` dark, `Floor` light, `Door` accent). Pressing the reroll key (Space) increments the seed and regenerates; the current seed is drawn on screen. Cell pixel size derives from window size / map dimensions. **Stretch (in scope if straightforward):** generate via `run_with_snapshots` and let Left/Right arrows scrub through the generation stages, drawing the snapshot at the current index (and a label). Because snapshots carry regions + edges too, the partition and connect stages are visible even though they don't change tiles — draw region outlines / edges for those frames. The renderer must contain **no generation logic** and reach into no engine internals beyond the public `Map`/recipe API (spec §3, §6) — that boundary is the proof the architecture holds. ## Interface Dependencies - **Consumes:** `dungeon()`, `DungeonConfig` (Task 12); `Map`, `Tile` (Task 5); `Pipeline::run`/`run_with_snapshots` (Task 6). - **Produces:** the `reikhelm-viz` binary. ## Tests - Rendering is interactive/visual — no unit tests required. Validation is manual via the success criteria below. - (Optional) a `color_of(Tile) -> Color` helper can have a trivial unit test if extracted. ## Success Criteria - [ ] `cargo run -p reikhelm-viz` opens a window showing a dungeon as colored tiles. - [ ] Pressing Space generates a new dungeon (new seed); the seed is visible on screen. - [ ] `reikhelm-viz` contains no generation logic and uses only `reikhelm-core`'s public API. - [ ] `cargo build` of the whole workspace succeeds. - [ ] (Stretch) Left/Right scrub generation stages, with partition/connect stages visibly distinct. ## Commit `"feat(viz): macroquad dungeon renderer with seed reroll"`