|
C M S C 2 1 4 C o m p u t e r S c i e n c e I I S p r i n g 2 0 0 4 |
Project 1 is worth 8% of your grade.
This project (and the 3 following it) deals with a robot moving about a chess-like board and picking up points or losing points depending upon what is in the cell it lands upon. The allowable "moves" of the robot will be stored in a circular doubly linked list of Pairs. Each pair consists of the direction of the move and the number of squares (positions) moved. The iterator class used in Project 0 will be adapted for this project to work on a circular dll. "Dit" becomes random access iterator. You will be coding the set-up of the project at this time. Other parts (like the Robot) will be added in later projects.
There will also be another pair, Mpair, that stores the row and column
on the playing board. This allows you to insert and change the contents
of the cells on the board.
This project implements the STL vector class as well as a circular doubly linked list. The goals of this project are to:
Please note that *all* programming projects in this course (including this one) are to be done independently or with the assistance of the instructional staff of this course only.
Please review the policies outlined on the class syllabus concerning the use of class computer accounts and concerning the University's Code of Academic Integrity. The instructors of this course will review the programs submitted by students for potential violations of the Code of Academic Integrity and if it is believed that a violation has occurred it will be referred to the Office of Judicial Programs and the Student Honor Council.
Hardcoding is considered a violation of academic integrity
Students are expected to write "clear and legible" code. Please review the following Style Guide which specifies how students in CMSC 214 are expected to lay out their code.
http://www.cs.umd.edu/class/spring2003/cmsc214/Projects/styleguide.txt
Points may be deducted for not following the style guide.
Answers to "frequently asked questions" will be posted via the main projects page. Prior to asking a question or submitting a project you should check the FAQ to see if any important information has been covered there. In addition to answers to FAQ's any important information pertaining to a project will be posted on it's FAQ.
DON'T email questions. We cannot keep up with the numerous emails about a project. GO SEE A TA or an instructor during office hours. We will generally NOT respond to email questions about the project.
For this project you will be required, among other things, to write the code for 7 classes:
Circular doubly linked list front after
inserting one node into the list:
Circular doubly linked list after inserting 3
nodes:
Circular doubly linked list showing iterators:
Board::Board(int r, int c, const
int&
init) :
rows(r), cols(c),
matrix(r,
vector<int>(c,
init))
{ }
vector<int> & Board::operator[](int
i) {
if (i < 0 || i >
rows)
throw
IndexRangeError("invalid row index, ", i);
else
return matrix[i];
}
After copying the header files into your account you should create the corresponding Pair.cpp, Node.cpp, Moves.cpp, Mpair.cpp, Board.cpp, Except.cpp and Dit.cpp files. You will write the code that implements the member functions for these classes. Note: you may NOT change the public methods in the header files but may add private methods as needed. You may NOT add private, public or protected data members to any class other than Except.h.
You must add public methods to Except.h only
In each header file you will find the class with it's data member(s) and member function(s). There is a comment before/around each member function describing what it should do. You are to implement (i.e. write the code for) the member function so that it does what the comment states that it should do and nothing more.
Next you should write 6 unit test files to test each of your classes:
A unit test file should be a main() for a particular class that calls and tests each public method. It also tests the private methods which are called from public methods. Note that when developing/writing code you should do so in parts/modules and test each as you create it (keeping backup copies!). So for example, when writing Node, you also write a testNode.cpp that is the main() for Node.cpp. It should call all public functions and include appropriate output to test that all Node.cpp code works correctly.
And finally you should test your project with the main provided:
It is expected that your output will match our primary.output exactly
You might wish to take the following approach to this project:
You may assume that
In order to adapt the iterator class to successfully work on our circular, doubly linked list, we must work with end(). In a circular dll, both begin() and end() would then be pointing to the same node "front". So let's do the following. Allow the range to go up to and include the last node in the range. Then the picture would indicate that if we processed this dll from begin() to end(), we will process ALL nodes.
There is NO DUMMY NODE in this dll. So when we ask for a range of
dll.begin() to dll.end(), the iterator can move from the 1st node in the
dll to the last node.
Iterator arguments indicate a range [x,y] where both x and y are included in the range. So, for example, if you were operating on a range erase(dll.begin(),dll.begin()) the result would be the erasure of 1 node. After operating on erase(dll.begin(),dll.end()), the entire dll would be emptied.
You may assume:
The input files are provided and will not be redirected input. You may hardcode "moves.dat" and "board.dat" when reading input. A primary output file is provided in the class posting accounts (in the appropriate directory). You should review these files. The output for submission is named primary.output.
Your project will successfully submit if it diffs with our primary.output.
Your program should generate the corresponding output similar to
primary.output. Additionally, we will test several methods from your
code.
When your main program is compiled and run with our input files so that it gets the contents of the "moves.dat" and "board.dat" as input, it should generate output that matches the primary output file. When we test your program we will diff your output (using diff -bwi) with that of the primary output and if it does not match, your program will be considered to not meet the minimum running standards and you should be unable to submit it.
Passing primary does not guarantee a passing grade (70 or above) for your project. Testing your program thoroughly helps.
If you need review on the String Class a few good web sites are:
Provide a makefile that creates an executable file named p1 when the command make p1 is run.
Tar up all necessary files, such as source code, including:
submit p1.tar 1
Submit will start accepting project 1 submissions on or about 02/17/04.
|
See the class syllabus for policies concerning email Last Modified: February 16, 2004 |
|
|
|
|
|