Maze
A maze is a spatial puzzle or problem space of connected and obstructed routes in which a path must be found between designated locations.
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
A navigational problem space consisting of connected locations and passages with a goal of finding a path between locations.
- How it is used
- Uses a grid navigation problem to exercise depth-first search, breadth-first search, and A*.
- How deep it goes
- Builds random generation, locations, legal moves, goal testing, and path display; does not guarantee a generated maze has a solution.
- Examples
- Runs searches on randomly generated 10-by-10 grids and prints routes marked with start, goal, and path characters.
- What you can do after
- Build it from scratch in Swift, then run a pathfinding algorithm and display a route when one exists.
Learn Go with Pocket-Sized Projects
A maze is a spatial puzzle consisting of connected and obstructed routes arranged so that a path must be found between designated locations.
- How it is used
- Uses mazes as a complete engineering exercise for concurrent exploration, image processing, command-line output, and testing.
- How deep it goes
- Explains grid encoding, constraints, neighbor discovery, entrance scanning, concurrent exploration, and focused tests.
- Examples
- Demonstrates edge and internal treasures, colored PNG grids, dead ends, branches, crosses, and small exploration test images.
- What you can do after
- Build a Go command-line solver that reads a PNG maze, finds its solution, highlights the route, and optionally creates an exploration GIF.
Read how Learn Go with Pocket-Sized Projects explains maze →
Related concepts
- PNGuses · PNG is a lossless raster-image file format supporting indexed, grayscale, and truecolor images, with optional transparency and metadata.
- griduses · A grid is a regular arrangement of positions or cells organized by rows and columns or by fixed neighboring relationships.
- A-star algorithmmeasured by · A* is an informed graph-search algorithm that prioritizes paths or states by combining the cost incurred so far with a heuristic estimate of the remaining cost to a goal.
- breadth-first searchmeasured by · Breadth-first search is a graph or tree traversal algorithm that explores nodes in nondecreasing order of their distance from a starting node.
- depth-first searchmeasured by · Depth-first search is a graph or tree traversal algorithm that explores one branch as far as possible before backtracking to explore alternatives.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

