The maze visualizer is an interactive web-based tool for visually inspecting and validating generated mazes. It makes it easy to spot-check the quality and correctness of generated datasets.
# After generating mazes
bun run visualize
# Or manually open
open visualizer.htmlThe visualizer will open in your default web browser and automatically load data/benchmark_maps.json.
Each maze is rendered as a colorful grid:
- 🟦 Blue (P) - Player start position
- 🟥 Red (D) - Destination/goal
- ⬛ Dark gray (#) - Walls (impassable)
- ⬜ Light gray (.) - Walkable tiles
- 🟧 Orange - Optimal path (when shown)
- Show/Hide Path - Toggle the optimal path overlay
- Step - Advance through the path one move at a time
- Reset - Clear the step-by-step visualization
- Path is displayed both on the grid and as a sequence below
Filter mazes by:
- Algorithm: Recursive Backtracker, Prim's, Cellular Automata, or All
- Size: 5x5, 10x10, 20x20, or All
Filters update the available maze pool instantly.
Multiple ways to move between mazes:
- Previous/Next buttons - Sequential navigation
- Keyboard arrows (←/→) - Quick keyboard navigation
- Random button (🎲) - Jump to a random maze
- Displays "Map X / Y" to show progress
Each maze displays:
- Map ID - Unique identifier (e.g.,
rb_5x5_bm_001) - Algorithm - Which generator created it (color-coded badge)
- Size - Grid dimensions (inner size)
- Path Length - Number of steps in optimal solution
- Current Map - Position in filtered results
| Key | Action |
|---|---|
→ |
Next maze |
← |
Previous maze |
Space |
Toggle path visibility |
- Generate dataset:
bun run generate - Open visualizer:
bun run visualize - Use filters to check each algorithm
- Click through several maps of each size
- Verify paths make sense visually
- Set size filter (e.g., "10x10")
- Set algorithm to "Recursive Backtracker"
- Look at a few maps, note the structure
- Switch to "Prim's Algorithm"
- Compare the different maze structures
- Switch to "Cellular Automata" to see organic layouts
- If you notice an issue with a specific map ID
- Open the visualizer
- Use Previous/Next to find that specific ID
- Show the path to verify it's correct
- Step through the path to ensure each move is valid
- Select a maze
- Click "Show Path" to see the complete optimal route
- Click "Step" repeatedly to trace the path move-by-move
- Verify the path connects P to D
- Check that the path doesn't pass through walls
- Confirm path length matches the step count
- Pure client-side - No server required
- Single HTML file - Fully self-contained with embedded CSS/JS
- Responsive design - Works on desktop, tablet, and mobile
- Fetch API - Loads
data/benchmark_maps.jsonasynchronously
Works in all modern browsers:
- Chrome/Edge (recommended)
- Firefox
- Safari
- Opera
Requires ES6+ support (all browsers from ~2017+).
- Loads all 90 benchmark maps instantly
- Smooth navigation even on large 20x20 mazes
- Path visualization updates in real-time
- Filters apply instantly without reloading
Problem: Visualizer can't find the benchmark data file.
Solution:
- Make sure you've generated data:
bun run generate - Check that
data/benchmark_maps.jsonexists - Open visualizer from the project root directory
Problem: Large mazes (20x20) might be hard to see on small screens.
Solution:
- Use landscape orientation
- Pinch to zoom on mobile browsers
- The visualizer automatically scales cells for smaller screens
Problem: Filter combination returns no results.
Solution:
- Check that you have generated maps for that combination
- Try "All Algorithms" and "All Sizes" to see all available maps
- Verify the benchmark_maps.json contains data
To also visualize the 900 fine-tuning maps:
- Modify the fetch call to load
finetuning_dataset.jsonl - Parse JSONL format (one JSON per line)
- Convert the format to match the benchmark structure
- Merge with or switch between datasets
The visualizer can be extended with:
- Heatmap - Show which cells are visited most often
- Statistics dashboard - Path length distribution, wall density
- Comparison view - Side-by-side algorithm comparison
- Animation - Animate the A* pathfinding process
- Export - Save maze as image (PNG/SVG)
Edit the CSS variables in <style> section:
.cell-wall { background: #2c3e50; } /* Walls */
.cell-empty { background: #ecf0f1; } /* Empty */
.cell-start { background: #3498db; } /* Start (P) */
.cell-destination { background: #e74c3c; } /* Goal (D) */
.cell-path { background: #f39c12; } /* Path */✅ Good maze characteristics:
- Clear path from P to D
- No isolated areas (all walkable cells connected)
- Appropriate wall density for algorithm type
- P and D are well-separated
- Path doesn't pass through walls
❌ Red flags to check for:
- P or D placed on walls
- No visible path between P and D
- Extremely short paths (might indicate poor placement)
- Isolated walkable areas not connected to main maze
- All walls or all empty (generation failure)
- Long winding corridors
- Many dead ends
- High path complexity
- ~60-70% walls
- Blocky room-like areas
- More open spaces
- Interconnected chambers
- ~60-70% walls
- Organic, irregular shapes
- Large open caverns
- Scattered obstacles
- ~40-50% walls (more open)
Need help? Check the main README.md or review CLAUDE.md for implementation details.