Author image

Maze Solving


A maze is a programming puzzle involving a collection of paths. What we seek to do here is construct an algorithm that will traverse a path starting from a specified location and ending to a destination location.

A Maze is typically given as an N*N array, eg. maze[N][N]. Imagine you're a rat trapped in the maze and you have to traverse the blocks to go from the Start to the Destination block. Reaching the destination blocks allows you to escape the maze and go free! The rat only possesses elementary movement abilities, either left/right or up/down. It's a 2d world for the rat and it suits us nicely.

In this example, we want to be able to construct a maze dynamically based on however many amount of rows and columns it consists of; for this reason we opted to use a vector of vectors - 2d vector called "maze".

You can provide whatever maze you want as input to this program. Use a file, place it somewhere inside the project and run the program by...

1