# CHeck my Maze Solver

• 07-31-2003
vasanth
CHeck my Maze Solver
I saw some one posting an interesting problem... Solving Mazes... Though I had an idea never programmed it... So gave it a try... I have created a DOS based program with a graphical interface where the user can build his own maze (map) and ask the computer to solve it... Please try it and give me your feedback... The code is much unstructured and not understandable as I did it in a hurry... Please excuse... ( I have included the executable.. Please extract all files before running the exe..)

I have used recursive function to solve it... it only finds a path and not necessaraly the shortest...

Note: - Use left clicks to build road (path) and right click to build blocks (Blockage) and use the Button S to solve the maze... The computer will try to find a path between the @ (Mouse) symbol and the top corner which says C (Cheese)

Vasanth
• 07-31-2003
moonwalker
It is pretty good although not fool proof. It found the best
solution after all. Pretty well done.
• 07-31-2003
vasanth
Well i have considered how people build maps and optmised it for that.. because many people usually tend to build it in up and right direction based on the position i have given.. If you change this it will take a longer route then....

Well is there any better way other than recursions....

Thanx
Bye
• 07-31-2003
DeepBlackMagic
I tried it, i made a curvy looping maze and it backtracked and even teleported once. lol. overall a good job. the single best way of maze pathfinding is to create a map of the level. example:

COOO
XOXO
XOXO
MOOO

Cheese Mouse Open XWall.
What you do is create an array starting at the cheese, moving out until all spaces are mapped.
[0 1 2 3]
[9 2 9 4]
[9 3 9 5]
[5 4 5 6]
Generally walls would be set some insanely high number like 65000 but this time i just used 9 for such a small maze.

The rule is simple. start at the mouse. check left right up and down and move to the square thats the lowest number. So your always moving closer. Move 5 4 3 2 1. start right up up up left. What do u think?
• 07-31-2003
PJYelton
Good job! Reminds me of a maze program I wrote awhile back using Win32. It creates a random perfect maze and then goes about solving it. I'll attach it to the end here with the source. Word of warning though, I made this before I completely understood windows programming and never got around to fixing it, meaning you can't resize the window and you can't close the window when its thinking.

Press enter to start the maze creation and enter again when the maze is done and you want to start to solve it.
• 07-31-2003
sean
Not bad. There was a guy on here a few weeks ago asking about AI methods of doing stuff like that. He'd love to hear this.
• 07-31-2003
drdroidHERE
if you check that thread, you'll see he responded to that... with the exact same program... i think you knew that though and were being sarcastic in which case I am just j/k otherwise....... HAH HAH HAH HAH HAH!!!
• 07-31-2003
vasanth
Quote:

Originally posted by PJYelton
Good job! Reminds me of a maze program I wrote awhile back using Win32. It creates a random perfect maze and then goes about solving it. I'll attach it to the end here with the source. Word of warning though, I made this before I completely understood windows programming and never got around to fixing it, meaning you can't resize the window and you can't close the window when its thinking.

Press enter to start the maze creation and enter again when the maze is done and you want to start to solve it.

Looks and works better than my DOS based maze program.. Keep it up...
• 07-31-2003
Lynux-Penguin
Very VERY well done. Reminds me of the code for Monkey Island. Hehe

-LC