LogicholicLogicholic
← All techniques

Game technique · Maze

Shortest Maze Paths with BFS

Breadth-first search checks reachable cells by distance from the start.

🎮 Play Maze →

How it works

Breadth-first search checks reachable cells by distance from the start.

Example

Visit each open neighbor once. When the exit is first reached, trace the parent cells backward to get a shortest path.

★
Shortest Maze Paths with BFS

Key point

Breadth-first search checks reachable cells by distance from the start.

🎮 Play Maze →