I've been using the maze_solution function from Image Analyst http://www.mathworks.com/matlabcentral/fileexchange/27175-mazesolution for a while without problems. There are a few limitations: the maze has to be perfect and without circular paths.
That being said, it generally works very well when I test it, let me provide you with two examples of outputs:
maze-1 -> solution-1 (Clearly works well)
maze-2 -> solution-2 (Not so well)
Now let me put some rules that are not obvious about my mazes:
- There are no circular paths (there are some that are trapped in the walls, but no one that the the maze solver would run into).
- They begin always at the top left, and then there are four exits in the same coordinates every time.
- There is always only one exit.
So, what I would like to do is, let's consider the first screenshot. It works well and 'finds' the exit, is there any way to make mat lab pop up a messagebox (using msgbox(), for instance) and say something like "Hey user, I found the solution! It's A!"? I already thought about this for a long while, but found no way of doing this. One of the solutions I thought about was, in pseudocode:
if CertainCoordinate = red pixel
return A
Whereas CertainCoordinate Could be the unchangeable coordinates (x and y) of A, B,C and D (Then I would use 4 'ifs'), but I don't really know how to implement even that. Any ideas or... something to point me in the right direction?
So, summarizing it: I have an algorithm that right now generates a red path to the exit (and I am open to better algorithms, if you have any suggestion) but my goal is to make matlab tell me what he found, instead of showing me in a image. So for instance, in the first image I would like it to open a MessageBox and say "Hey user! I found the exit, it's D!", instead of showing me the image with the red path on it. The problem is, I don't know how to teach MatLab 'where is D' and to make him recognize that he found 'D'. So, are there any suggestions on how to do that?
Thanks in advance!