|
C M S C 2 1 4 C o m p u t e r S c i e n c e I I F a l l 2 0 0 2 |
Read the FAQ for updates/corrections. Items that have changed from the previous version will be marked in red to make it easier to spot changes.
You are expected to read FAQ on a daily basis.
We suggest you look at the webpage sometime in the evening to see if any updates have occurred. Common student errors and their solutions are often posted in the FAQ (this will be up soon, once some questions are available). Contact your TA for questions, and they can forward it to the instructors if necessary.
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
Some students see the objective of programming as "get the project to work", and believe that getting it to work means writing as much code as possible. Planning code, testing code, and documenting code is seen as a hassle, something that is unimportant. Unfortunately, nothing could be further from the truth.
If you program for a living, you will eventually have to work in teams, and the code you write must be well thought out, otherwise, it will be hard to maintain, contain bugs, etc. Documentation is important because other people need to know what your code does, and you need to know what other people's code does. So, even if you believe it's "busy work", it serves a useful purpose.
This project consists of several exercises, which will be listed as tasks.
In previous courses, you have been told to write your code "with good style". You were told penalties would be assessed if you didn't write with good style. However, some people still have poorly indented code, inconsistent style, that not only makes code look unprofessional, but also hard to read and debug.
You will implement a class called Tokenizer. You are provided a file called Tokenizer.h. Implement the methods.
All methods in this file are static.
You will implment a queue class called MovieQueue. You are provided a file called MovieQueue.h, Movie.h and Movie.cpp. The Movie class should be implemented for you.
You will also implement a unit testing class called MovieQueueUnit to test MovieQueue. The queue is implemented as a linked list. You may wish to read the text on queues, if you are unfamiliar with them.
The purpose of this task is twofold: first, to get you practice writing a queue (this is a good warmup for writing a linked list). Second, to learn how to write test code prior to implementing the class. This idea is used in XP (extreme programming). Read the full description by clicking on the link above.
You should document the following files: ItemArrayList and ItemSortedList. The documentation is specified in the links above.
(9/18) You do not need to write documentation for classes in Tasks 1, 2, 3. Notice that documentation and commenting code are NOT the same. Documentation appears in .dcmt files and are just plain text. Commenting appears in your .cpp files.
Here's another useful link that pertains to documenation:
Read the next task before starting this one.
You need to implement the following classes: Item, ItemArrayList, ItemSortedList, plus any nested classes. The specifications are above.
The following link is a review of singly linked lists (SLL).
The following link to nested classes is NOW READY.
The following link for converting numbers to strings might be useful to you. (NEW: 9/21)
(9/18) You should implement ItemSortedListUnit as well (the unit testing class for ItemSortedList). Implement at least 5 test methods. It's optional to write this for other classes, but consider it, if you find the idea useful.
This is an live version of Task 6. This means it has been looked over some more, and is pretty much the way it's going to be (short of overlooked bugs). You may begin to email clarifications and/or bugs in the description.
The following are secondary files. You do NOT implement these (they are used for Task 3).
For each command, you should print out the command
as follows:
<out> := "(" <count> ") [" <cmmd> "]" <endl>
<count> := <udigits>
where <cmmd> is any one of the commands listed in the
next section, and <count> is the count of the command
number, which begins numbering at 1.
This will be called the command echo.
You may assume:
However,
This is the BNF (where % is short for zero or more blanks
and %% is short for one or more blanks). Read the EBNF on
the tutorial webpage for more information.
<cmmd1> := % MOVE %% <direction> %% <units> % <endl>
<direction> := [ "N" | "W" | "S" | "E" | "n" | "w" | "s" | "e" ]
<unit> := <udigits>
You can move in one of four directions, "N" is north, "W" is west,
"E" is east, "S" is south. The units are integer values. You
can assume that they number is positive. The directions can
be in lower-case too.
There are a variety of messages that can occur once the move is complete.
After printing the command echo, print:
<out1> := "Player successfully moves " <units> " units "
[ "EAST" | "WEST" | "NORTH" | "SOUTH" ] <endl>
"Player is currently at " <coord> <endl>
<coord> := "(" <udigits> "," udigits> ")"
Note: <coord> will be used often in later BNF.
The output is printed in the following order, AFTER the player has completed the move in a particular direction.
Here's the BNF.
<out1> := "Player successfully moves " <units> " units "
[ "EAST" | "WEST" | "NORTH" | "SOUTH" ] <endl>
[ "Box is moved from " <coord> " to "
<coord> <endl> ]?
[ "Player picks up [" <name-of-item> "] at "
<coord> <endl> ]*
[ "Box crushed [" <name-of-item> "] at "
<coord> <endl> ]*
"Player is currently at " <coord> <endl>
<name-of-item> := <word>
Some notes:
Suppose a player is attempting to move NORTH 8 units. This may not completely succeed. A player may only successfully move part of the distance.
There are several reasons this may happen:
In the process, the player may pick up or crush items.
The output is printed in the following order.
<out1a> := "Player ONLY moves " <units> " of " <units> " units "
[ "EAST" | "WEST" | "NORTH" | "SOUTH" ] <endl>
[ "Player is blocked by "
[ "outer wall" | "wall at " <coord> ] <endl> |
"Box at " <coord> " is blocked by box at "
<coord> <endl> |
"Box at " <coord> " is blocked by "
[ "outer wall" | "wall at " <coord> ] <endl> ]
[ "Box is moved from " <coord> " to " <coord> <endl> ]?
[ "Player picks up [" <name-of-item> "] at " <coord> <endl> ]*
[ "Box crushed [" <name-of-item> "] at " <coord> <endl> ]*
"Player is currently at " <coord> <endl>
Some notes:
This takes no arguments. After printing the command echo, you should print the current configuration of the board. The board should be printed using the following symbols.
You should print a blank space between each pair of symbols. Thus, there should be 20 characters per line (10 characters to represent the items on the board, plus 9 blanks, plus a newline to signify the end of line).
This is the BNF.
<display> := [ <line> ]{10,10} <endl> [ <more> ]?
<line> := <char> [ <blank> <char> ]{9,9} <endl>
<char> := "." | "P" | "#" | "@" | <lower>
<more> := "Legend" <endl> "------" <endl>
<list-items>
<list-items> := [ <one-item> ]+
<one-item> := "(" <lower> ") [" <name-of-item> "] "
<udigits> " pts" <endl>
So, print the letter of the item in parentheses (starting with "a",
"b", "c", etc.), followed by a space, followed by a left bracket, then
the item name, then a close bracket, then the number of points
the item is worth, then "pts", and finally a newline.
The list should print out in alphabetical order. This should be case-insensitive. You may assume the items have one word names that may be written in any combination of upper or lowercase letters and digits.
Similar to DISPLAY. Print the board as before, but this time, print the legend backwards. Thus, if there were five food items on the board, you should label them (e), (d), (c), (b), (a).
Use iterators in the reverse direction to print backwards.
This displays the food items that the player has picked up so far. This MUST be displayed in the order that the player picked up the food item. Recall that as the player walks over a coordinate with a food item, it is picked up by the player (there is no command to pick items, so this is done when player does MOVE over a food item), and the player stores that information.
After printing the command echo, print the following:
<show-food> := "Food items" <endl>
"----*----*" <endl>
[ <food-list> | <no-food> ]
<endl> <total-points>
<no-food> := "Player is not carrying any food items" <endl>
<food-items> := [ <food> ]+
<food> := "(" <udigits> ") [" <name-of-item> "]" <udigits> " pts" <endl>
<total-points> := "The player has (" <udigits> ") total pts"
Note: there are 4 dashes and a star, followed by 4 dashes and a star.
If the player is not carrying any food items, then print the <no-food> message. If the player is carrying food items, then print out the number (starting at 1), in parentheses, followed by a space, followed by a left bracket, the food item, followed by a right bracket, then a newline.
After the list of food items, print the total points of all food items (sum them up) that the player is carrying.
Note: the food items must be printed in the order they were picked up.
This command has no arguments.
After printing the command echo, you should print
the following:
<quit> := "Exiting program. Thanks for playing!" <endl>
You should not accept any further commands (i.e., ignore
the rest of the input).
<all> := <boxes> <walls> <food-list> <player> <cmmds>
<boxes> := % "<box>" % <endl>
[ % <coord> [ %% <coord> ]* % <endl> ]*
% "</box>" % <endl>
<walls> := % "<wall>" % <endl>
[ % <coord> [ %% <coord> ]* % <endl> ]*
% "</wall>" % <endl>
<food-list> := % "<food>" % <endl>
[ % <one-food-item> ]*
% "</food>" % <endl>
<one-food-item> := % <food-name> %% <points> %% <coord> % <endl>
<food-name> := <word>
<points> := <udigits>
<player> := % "<player>" % <endl>
% <coord> % <endl>
% "</player>" % <endl>
<cmmds> := % "<command>" % <endl>
[ % "MOVE" %% <dir> %% <udigits> % <endl> |
% "DISPLAY" % <endl> |
% "DISPLAY_BACKWARD" % <endl> |
% "SHOW_FOOD" % <endl> |
% "QUIT" % <endl> ]*
% "</command>" % <endl>
For each of the REQ, put a comment in the code and/or header file where you have met these requirements. For example, you would write // REQ1. This way, the graders can easily find where you have met the requirements. If these are missing, we may deduct points, even if you have met the requirements.
Here are some requirements/restrictions:
At the top of the file, after your name, etc. Explain why you felt you needed this class.
You may feel free to use whatever string methods or vector methods you can find in the book, etc., unless it is not in the spirit of the project (e.g., don't use vectors, when you are asked to use a ItemSortedList).
In order to successfully submit your project, it must pass
the primary input and produce the primary output. The primary
input will be sent to your project using input redirection.
p1 < primary.input
Your program MUST produce the executable p1, EXACTLY, when
the command "make" is run with no arguments. Thus, you must use
a makefile named exactly "Makefile".
We will use "diff -bwi" to test your code. This ignores case, treats N blanks as 1 blank, treats N blank lines as 1 blank line. We will also strip all blank lines from your input when matching to ours. However, diff is sensitive to punctuation, number of dashes, etc. so you should attempt to make your output match ours as closely as possible otherwise you may not be able to submit your program. If this is the case (that your program does not submit) you must fix your code until the output it produces matches that of the primary output. Note: "hardcoding" output is a violation of the University's Code of Academic Integrity.
To submit your project you must first combine the following files (and only these files) into a single tar file using the Unix tar command:
You may name your tarfile anything you want, but p1.tar is the suggested name.
NOTE! You should make a backup copy of all your files BEFORE attempting to create your tarfile!!!! You have been warned.
After creating the tar file you should submit that one file using
the following command:
submit p1.tar 1
where p1.tar can be replaced by whichever tar file you
have created, and 1 refers to the current project,
|
See the class syllabus for policies concerning email Last Modified: Tue Feb 12 19:48:57 EST 2002 |
|
|
|
|
|