Maze Solving Algorithm - Shortest Path Algorithm

Shortest Path Algorithm

When a maze has multiple solutions, the solver may want to find the shortest path from start to finish. One possible algorithm finds the shortest path by implementing a breadth-first search, while another, the A* algorithm, uses a heuristic technique. The breadth-first search algorithm uses a queue to visit cells in increasing distance order from the start until the finish is reached. Each visited cell needs to keep track of its distance from the start or which adjacent cell nearer to the start caused it to be added to the queue. When the finish location is found, follow the path of cells backwards to the start, which is the shortest path.

Read more about this topic:  Maze Solving Algorithm

Famous quotes containing the words shortest and/or path:

    Jesus wept.
    Bible: New Testament John, 11:35.

    The shortest verse in the Bible; refers to Jesus’ grief at the death of Lazarus, whom he raised from the dead after four days.

    They are not long, the days of wine and roses:
    Out of a misty dream
    Our path emerges for a while, then closes
    Within a dream.
    Ernest Christopher Dowson (1867–1900)