sed -E -f solver.sed input
where input
is a file containing the maze.
For best results, resize your terminal to match the height of the maze. To disable animations, delete the lines containing p
.
The solver assumes the following:
- The maze only contains the characters
# \nSE
- Every line has the same number of characters
- There is only one start (
S
) and end (E
) - There exists an unbroken path from the start to the end
There is no need to wrap a border around the maze but it does make the output clearer.
FYI for anyone trying this, you need GNU sed for it to work. If using macOS, you'll need to install
gnu-sed
from Homebrew and then invoke viagsed
rather thansed
.