UMBC CMSC 202
UMBC CMSC 202 CSEE | 202 | current 202

CMSC 202 - Project 3

Pointing out a Maze Solver

Assigned Sunday April 2, 2006
Design Due Saturday April 8, 2006 at 11:59 pm
Program Due Sunday April 16, 2006 at 11:59pm
Updates
  • April 8 - Word change - dereference pointers before calling overloaded operators on the object
  • April 8 - General tips updated, insertion changed to extraction

Objectives


General Project Description

As an employee of Childrens' Games, Inc., you have been tasked with the responsibility of demonstrating that all of the mazes that have been generated for the new Maze & Puzzle book are indeed solvable. Fortunately, another developer has created an application that generates "perfect" mazes (perfect mazes have exactly one path from start to finish, thus having no loops). It is your responsibility to double-check each maze that the application generated so that children around the world will have brighter lives when they receive the Maze & Puzzle book as a gift.

Project Description

Dynamic Memory

For the third phase of the project, your boss requires that you modify your application to take advantage of Dynamic Memory by modifying your code to use dynamically allocated memory for ALL instances of your user-defined classes. All Mazes, MazeCells, and MazeCrawlers will need to be dynamically allocated and managed.

You must implement the Big Three (Destructor, Copy-Constructor and Assignment operator) for each of these classes.

You are also required to modify the MazeCell class to use pointers to its neighbors to determine which directions are open. You will also need to make modifications to the Maze and/or MazeCrawler classes to support this new connection between MazeCells.

Operator Overloading Updated!

You are required to overload the insertion operator for each of your user-defined classes. You should take advantage of any code you have already written and reuse it. Do not duplicate code. Replace any calls to existing "Print" (or similar) functions with calls using the insertion operator. You may choose to delete any functions that accomplish the same task.

You are also required to overload the extraction operator for the Maze class. Again, feel free to reuse any existing code. Do not duplicate code. You may choose to delete any existing methods that accomplish the same task. The stream passed into the extraction operator should be an open file.

All overloaded operators must operate on OBJECTS of each class, NOT on pointers to an object. You should remember to dereference pointers before attempting to use the overloaded operators on them.

Functional Description

Your program is required to perform the same tasks as described in Projects 1 and 2. Your program should also function in the same manner as described in Projects 1 and 2. Example maze files should continue to operate in the same manner as previously described.

Design and Implementation Requirements

Dynamic Memory

You are required to modify your existing system to use dynamic memory in the creation and maintanence of all user-defined objects. All instances of Mazes, MazeCells, and MazeCrawlers must be created dynamically.

Each of these classes must have the Big Three implemented and used appropriately. All instances of dynamic memory in these classes should be properly allocated and deallocated in the Big Three. Even if your class does not allocate dynamic memory, you must overload the Big Three.

Dynamic Neighbor Links

You are required to restructure your application to support determining which direction to travel by examining the neighbors of a MazeCell directly from that MazeCell. This connection is similar to a Linked-List where each Node knows about the "next" and/or "previous" Node in the list. In our application, each MazeCell has a link to each of its four neighbors.

The purpose of this optimization is to speed up the time it takes to compute which direction to travel. It also eliminates the need for row and column computations when finding a neighbor during each decision of next direction.

When attempting to determine which direction to move from the current cell, your MazeCrawler can examine each of the neighbors by accessing them via pointers. Then, once it makes a decision, it can simply follow that pointer to move to the neighboring cell. This moves our application one more step toward low-coupling, allowing our MazeCrawler to have absolutely NO knowledge of the internal representation of the Maze - all it needs is a pointer to the current cell!

Depending on your current implementation, you may or may not need to make changes to the Maze class as well as the MazeCrawler when modifying your MazeCell class to support these dynamic links. Ideally, after implementing dynamic links, your application could support Mazes of arbitrary shape and size.

Operator Overloading

In addition to the Big Three, you are required to overload the insertion operator for all user-defined classes.

You are also required to implement the extraction operator for the Maze class. The extraction operator should accept a stream, and read the maze from that stream. If the stream passed is a file stream, the file should already have been successfully opened.

General Tips Updated!


Project Design Assignment

Your project design document for this project must be named p3design.txt. Be sure to read the
design specification carefully. Submit your design in the usual way: submit cs202 Proj3 p3design.txt Remember - the design is due ONE WEEK before the project. Late designs will not be accepted.

Project Makefile

The "make" utility is used to help control projects with large numbers of files. It consists of targets, rules, and dependencies. You will be learning about make files in lab. For this project, the makefile will be provided for you. You will be responsible for providing makefiles for all future projects. Copy the file makefile from Ms. Wortman's public directory to your directory.

When you want to compile and link your program, simply type the command make or make Proj3 at the Linux prompt. This will compile all necessary .cpp files and create the executable named Proj3.

The make utility can also be used for compiling a single file without linking. For example, to compile Proj3.cpp, type make Proj3.o.

In addition to compiling and linking your files, make can be used for maintaining your directory. Typing make clean will remove any extraneous files in your directory, such as .o files and core files. Typing make cleanest will remove all .o files, core files, Proj3 executable and backup files created by the editor. More information about these commands can be found at the bottom of the makefile.

Updated: If you are building your own makefile, you MUST use the /usr/local/bin/g++ compiler to compile and build each file. Do not depend on setting your default compiler to be this compiler, the grader may use a different compiler. There are two compilers on the GL systems, and you are required to use the one located at /usr/local/bin/g++.


Grading

The grade for this project will be broken down as follows. A more detailed breakdown will be provided in the grade form you receive with your project grade.

85% - Correctness

This list may not be comprehensive, but everything on this list will be verified by the graders.

15% - Coding Standards

Your code adheres to the
CMSC 202 coding standards as discussed and reviewed in class.

Project Submission

Steps for Submission

  1. submit all files
  2. submitls to verify they are in the remote directory
  3. submitmake to build your files remotely
  4. submitrun to run your files remotely
Assuming you've used the recommended file names, then to submit your project, type the command submit cs202 Proj3 Proj3.cpp Proj3Aux.cpp Proj3Aux.h Makefile The order in which the files are listed doesn't matter. However, you must make sure that all files necessary to compile your project (using the makefile) are listed. You need not submit all files at the same time. You may resubmit your files as often as you like, but only the last submittal will be graded and will be used to determine if your project is late. For more information, see the projects page on the course website.

You can check to see what files you have submitted by typing

submitls cs202 Proj3

Be sure to build your project once it has been submitted using the submitmake command, so that you know that all of the files are there and are the most up-to-date versions:

/afs/umbc.edu/users/d/a/dana3/pub/CMSC202/submitmake cs202 Proj3

Test your program to ensure that all files are the most recent versions:

/afs/umbc.edu/users/d/a/dana3/pub/CMSC202/submitrun cs202 Proj3

Details on Submit Tools.

Remember -- if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause compiler errors and a reduction in your grade.

Avoid unpleasant surprises!

Be sure to use the submitmake and submitrun utilities provided for you to compile, link and run your program after you've submitted it.


Last Modified: Saturday, 08-Apr-2006 20:29:58 EDT