-
June 21st, 2011, 05:19 PM
#1
Solving a Maze in C++. URGENT Help Needed :)
Hi guys !
I'm new on your forum but I'm not new to programming.
I'm in collage and I need to write a program in C (actually using some of C++ features, but no OOP - just OP).
The program loads MAZE features (starting point, finish point, "walls") from a file, and it shoes the SOLUTION.
- Without using recursion
- using directions {{0,1} {1,0} {-1,0} {0,-1}}
- saving the current way (probably best saving it to another board)
- no OOP, OP only (using C++ read/write/file handling functions)
THIS IS REALLY URGENT, I don't hace much time but if one of you guys already has a similar solution, it will be a great help for me.
I can not afford failing this one .. that's really important for me.
Thanks again,
Eli
-
June 22nd, 2011, 07:17 AM
#2
Re: Solving a Maze in C++. URGENT Help Needed :)
Those of us that can help you are in a position to do so because we did our own homework. You'll need to show that you've made an effort before anybody here will help you.
-
June 22nd, 2011, 07:45 AM
#3
Re: Solving a Maze in C++. URGENT Help Needed :)
Have you been given a maze solving algorithm?
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
June 22nd, 2011, 07:52 AM
#4
Re: Solving a Maze in C++. URGENT Help Needed :)
-
June 22nd, 2011, 10:30 AM
#5
Re: Solving a Maze in C++. URGENT Help Needed :)
If you think of a maze as a graph, where the the open intersections of the maze are a vertex, and each corridor is an edge connecting two verticies, then you are looking for the path that connects the vertex at the maze entrance vertex and the maze exit vertex.
Most search functions are recursive, so you may want to look at older pathfinder or depth first searches in Fortran 77, since that language didn't support recursion. I would write it out in pseudo code so you can see what you need the algorithm to do. You need to begin by loading the maze into a data structure. I think some kind of connection table would be best, but it's hard to know without seeing the form the maze is currently in. After you have a data structure for the possible paths, then you can start to look at the best way to navigate.
LMHmedchem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|