Version 10/11/17
Educational Objectives: After completing this assignment, the student should be able to accomplish the following:
Operational Objectives: Implement a maze solver as a client of fsu::DFSurvey.
Deliverables:
bfsurvey.h # contains implementation of Search(x,y) dfsurvey.h # contains implementation of Search(x,y) solvemaze.cpp # client program of fsu::ALDGraph and fsu::DFSurvey; solves maze makefile # creates targets ranmaze.x, solvemaze.x log.txt # development and testing log
The official development/testing/assessment environment is specified in the Course Organizer. Code should compile without warnings or errors.
In order not to confuse the submit system, create and work within a separate subdirectory cop4531/proj6.
Maintain your work log in the text file log.txt as documentation of effort, testing results, and development history. This file may also be used to report on any relevant issues encountered during project development.
General requirement on genericity. Use generics whenever possible. For example:
In short: re-use components from LIB (or your own versions) whenever possible. Don't re-invent the wheels.
Begin by copying all of the files from LIB/proj6 into your proj6 directory along with relevant executables from area51. You should see at least the following:
bfsurvey_stub.h # has non-functional implementation of Search(x,y) dfsurvey_stub.h # has non-functional implementation of Search(x,y) deliverables.sh # submission configuration file ranmaze_i.x # sample executable solvemaze_i.x # sample executable mazemaster_i.x # maze analyzer
Execute ranmaze_i.x to generate maze files and solvemaze_i.x and observe behavior. It may be helpful to use the visualization tools discussed below (and in the Ranmaze project).
Implement the methods BFSurvey::Search(Vertex x, Vertex y) and DFSurvey::Search(Vertex x, Vertex y). These should perform the same functionality as the 1-argument versions, except that the process is halted immediately after a path from x to y has been computed.
Note that these are called by Path_BFS and Path_DFS, respectively.
Create the file solvemaze.cpp, a client of DFSurvey<>. Be sure that the implementation is built around a call to Path_DFS. Test thoroughly to be sure the solutions it generates are correct and that the behavior mimics that of LIB/area51/solvemaze_i.x, including the file name extensions for output files.
Check that ranmaze.cpp [both yours and the area51 version] and solvemaze.cpp inter-operate correctly and meet the specifications given below.
Be sure that you have established the submit script LIB/scripts/submit.sh as a command in your ~/.bin directory.
Warning: Submit scripts do not work on the program and linprog servers. Use shell.cs.fsu.edu or quake.cs.fsu.edu to submit projects. If you do not receive the second confirmation with the contents of your project, there has been a malfunction.
Client program uses Path_DFS, CheckSymmetry, and LoadMaze from the fsu graph library. Command line argument: maze file (required).
Program reads maze file into a directed graph model, checks the digraph for symmetry (consistency for the maze), solves the maze, and appends solution to a copy of input maze file with ".dfs" extension.
It's a good idea to be familier with the fsu:: graph framework before using it: see FSU Graph Framework
The "workflow" for solvemaze is: (1) open and read the mazefile, building a directed graph; (2) check this digraph for symmetry, which in maze terminology means consistency of the maze; (3) solve the digraph using depth-first search; (4) write the maze file (including any file header documentation) to a new maze file and append the DFS solution.
The output file name is the same as the input file name with ".dfs" appended.
The following image shows a dfs solution of the maze illustrated in the previous project document.
The executable area51/mazemaster.x is useful in analysing small maze files while the maze programs are under development. The mazebuilder-olson and mazebuilder-brown javascripts (written by former students) are useful in creating small mazes for testing.
If you have web space on ww2.cs.fsu.edu, you can set up a quick maze viewer as follows:
Put a script "mazegen.sh" in your space with contents:
#!/bin/sh now=($( date '+%F %H:%M')) DATE=${now[0]} TIME=${now[1]} TIME_STAMP=${DATE}_${TIME} ranmaze.x $1 $2 _TEMPMAZE cp _TEMPMAZE maze$1x$2.$TIME_STAMP # saves copy of maze printmaze.x -h12 -w12 < _TEMPMAZE.1 > _TEMPMAZE.ps pstopnm -stdout -yborder=0 -xborder=0 -portrait -xsize=1000 _TEMPMAZE.ps | pnmtopng > maze.png chmod 644 maze.png rm _TEMPMAZE* echo "maze graphic in maze.png"
Make a simple web page "viewmaze.html" with contents as follows:
<html> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> <title>ViewMaze</title> <style type = "text/css"></style> </head> <body link="black" vlink="black" alink="#808080"> <br> <blockquote> <IMG SRC="maze.png" ALT="maze.png"><br> Maze generated by ranmaze. Solution obtained using Path_BFS in graph model. </body> </html>
Put copies of solvemaze.x and printmaze.x in the same directory.
Change permissions of *.x and *.sh to 700.
Change permissions of viewmaze.html to 644.
Then running "mazegen.sh $1 $2" followed by a refresh of the page will display the newly generated maze. Here is a working example: mazegen2.
Alternatively you can drag maze.png to your desktop and view it there.