--- license: mit pretty_name: "Maze Solver Benchmark (BFS shortest path by maze size)" language: - en tags: - maze - bfs - shortest-path - recursive-backtracker - pathfinding - benchmark task_categories: - other size_categories: - n<1K configs: - config_name: bfs_by_size data_files: data/maze-benchmark.json --- # Maze Solver Benchmark — BFS Shortest Path by Maze Size By **[LK Forge](https://lkforge.com)**: privacy-first browser tools & games, nothing to install, nothing uploaded. Search effort and path length for the [LK Forge Maze Solver](https://lkforge.com/tools/puzzles/maze-solver/), which generates a **perfect maze** with a recursive-backtracker and finds the **unique shortest path** with breadth-first search. 200 seeded mazes per size. - **How the solver works:** https://lkforge.com/tools/puzzles/maze-solver/how-the-maze-solver-works.html - **Try it:** https://lkforge.com/tools/puzzles/maze-solver/ - **Producer:** [LK Forge](https://lkforge.com) — client-side AI games, solvers, and tools. ## Headline numbers (200 mazes each) | Maze | Open cells | Mean shortest path | Mean cells visited by BFS | % of open cells explored | |---|---|---|---|---| | 12×12 | 287 | 131 | 185 | 64.5% | | 20×20 | 799 | 308 | 487 | 60.9% | | 30×30 | 1,799 | 607 | 1,071 | 59.5% | | 40×40 | 3,199 | 972 | 1,784 | 55.8% | In a perfect maze there is exactly one path between any two cells, so BFS returns the unique shortest route. It explores a **fairly stable ~56–65% of all open cells** before reaching the exit, and both path length and search effort scale roughly linearly with the number of open cells. ## Files - `data/maze-benchmark.json` — per size: open cells, mean shortest-path length, mean cells visited, % explored. ## Method - **Engine:** the recursive-backtracker generator and BFS solver copied verbatim from the shipped `maze-solver.js` (DOM stripped, `Math.random` → seeded RNG, size parametrized). - **Cells visited** = BFS dequeue count (machine-independent search effort). ## Reproduce ```bash node scripts/benchmark-maze.mjs ``` ## Citation > LK Forge (2026). *Maze Solver Benchmark — BFS Shortest Path by Maze Size.* > https://lkforge.com/tools/puzzles/maze-solver/ Everything runs client-side, no login, no tracking.