# Maze solver

Hey

I'm new to using matlab, however i have an assignment where i have to use matlab to load a maze and then solve it.

I have no idea how to start on this assignment. i'm not asking for you to do it for me but i desperatly need to how to start and roughly what code i should use, eg. loops, arrays or whatever.

• I forgot to add, the maze can be a bitmap or jpeg and has black walls with white inside. the maze that the program is being tested with may have multiple entries and exits but it doesnt matter which ones the program uses. The program also has to display the solved maze on screen with the path indicated. I have a rough idea of how to display images using matlab but thats it really.
• I'd start off by doing an "array = imread(pic)", and then take one of the sides as being the entrance way, so for logic's sake, take the left sade ;-).
Then I'd make a for that runs down the first column of my newly created array and compare with white spaces, whenever you read a white space you have a new entrance, you can store it's coordinates.

Afterwards my guess is as good as yours tbh, without much thinking, I'd try to figure out an algorithm that senses the values around any given point in that matrix. So like, if you have a white point on x=5,y=5, have it sense for white spots on x=6,y=5; x=6,y=4; x=6,y=6; x=5,y=4; ...
Whenever you stumble on more than one white point, you add another checkpoint, so you can return to this value if you don't come to an end.

I've never had to do this, so again, my guess is as good as yours but pls, keep us updated.
• Thanks for the help. I've figured out how i want matlab to solve the maze, the help with assigning it to an array helped a lot. right now i'm just working on getting the code into matlab.
• np, how exactly did you implement the pathfinder? AI techniques or just for's? 