Skip to content

Instantly share code, notes, and snippets.

@blake41
Last active December 28, 2015 19:38
Show Gist options
  • Save blake41/7551165 to your computer and use it in GitHub Desktop.
Save blake41/7551165 to your computer and use it in GitHub Desktop.
Build a maze solver
###########
# #
# ##### # #
# # #
### # ### #
# # #
# # ### ###
# # #
# ### # # #
# # #
###########
Create a maze solver. Use the maze in maze.txt.
You should read this file in and save it as some data structure that allows you to work with it in a sensible manner.
In case you can't read the maze, you enter on the left side on line 4, and the exit is on the right side line 8.
Tips, you can use either depth first or breadth first search. These are ways of traversing a graph. One uses a stack, one uses a queue.
It would be cool if you solved it both ways.
You'll need to have some way of keeping track of the sucessful path, I'd suggest a linked list.
You can see my solution at https://github.com/blake41/mazes
I heavily borrowed from https://gist.github.com/AgileMantis/3143867
as I did not know how to solve something like this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment