File size: 2,296 Bytes
ab3cba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87add16
 
ab3cba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
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.