Skip to content

An example of how to use A-star search in the Boost Graph Library to solve a maze.

License

Notifications You must be signed in to change notification settings

pradeepr-roboticist/Astar-Maze-Solver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A-Star Maze Solver

This program uses the A-star search algorithm in the Boost Graph Library to solve a maze. It is an example of how to apply Boost Graph Library algorithms to implicit graphs.

The solver consists of a single program called astar-maze. This program generates a random maze and tries to find the shortest path from the lower left-hand corner to the upper right-hand corner. Mazes are represented by two-dimensional grids where a cell in the grid may contain a barrier. You may move up, down, right, or left into any adjacent cell that does not contain a barrier.

Once a maze solution has been attempted, the maze is printed. If a solution was found it will be shown in the maze printout and its length will be returned. Note that not all mazes have solutions.

The default maze size is 20x10, though different dimensions may be specified on the command line.

Installation

You must have the Boost Graph Library version 1.44 or higher installed. Set BOOST_PATH in the Makefile to point to the root of your Boost include tree. The astar-maze program builds in the distribution directory and does not install anywhere else on the system.

Implementation

The maze is represented by the maze class. This class has a grid graph member which defines the underlying grid. All edges are assigned a weight of one. Barriers in the maze are removed from the underlying grid using a graph filter. The maze is searched using the A* search algorithm.

History

  • Version 1.0.0: Initial release

Copyright

Copyright W.P. McNeill 2010.

Distributed under the Boost Software License, Version 1.0.

See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.

About

An example of how to use A-star search in the Boost Graph Library to solve a maze.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 95.2%
  • Makefile 4.8%