Maze solver - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Maze solver

Jezza28Jezza28 Posts: 3Member
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.

Thanks in advance.

Comments

  • Jezza28Jezza28 Posts: 3Member
    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.
  • nipnip Posts: 5Member
    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.
  • Jezza28Jezza28 Posts: 3Member
    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.
  • nipnip Posts: 5Member
    np, how exactly did you implement the pathfinder? AI techniques or just for's? :)
Sign In or Register to comment.