Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
CS 2420 Program 6 Fall 2010 30 points See Eagle for Due Dates
 

Summary: CS 2420 Program 6 Fall 2010
30 points See Eagle for Due Dates
Part 1 Disjoint Set Class (10 points)
Create a class to do union/find operations in an efficient manner. Demonstrate the class works.
For ease in grading, leave this test in your TestMaze.cpp file.
Part 2 Solve the Maze (10 points)
MazeStarter.zip contains some starter code that may be helpful. You do NOT need to use it if you don't like it.
The supplied code reads the maze from a file. Read the input maze at maze1.txt and solve the maze using
recursive backtracking.
The number of rows and columns must be odd. For simplicity, we assume the size of the maze is a constant.
The starting position will always be at position (1,1) The final position will be at (MAZE_ROW-2,
MAZE_COL-2)
Recursive backtracking: This will find a solution, but it won't necessarily find the shortest solution. Let the
curr location be Start. If every direction (from curr) is either a wall or someplace you've already visited, return
failure. If you're at the finish, return success. Otherwise, recursively try moving in the four directions from your
curr location. When you move north, south, east or west, mark the previous spot with `^', `v', `>', or `<' so we
can tell which way you went. Erase the symbol when you return failure (from curr), and a single solution will
be marked out when you hit the final location. When backtracking, it's best to mark the space with a special
visited value, so you don't visit it again from a different direction. In Computer Science terms, this is basically a
depth first search. This method will always find a solution if one exists, but it won't necessarily be the shortest

  

Source: Allan, Vicki H. - Department of Computer Science, Utah State University

 

Collections: Computer Technologies and Information Sciences