2
Assigned | Wednesday March 1, 2006 |
Due | 11:59pm Tuesday March 14, 2006 |
Updates |
10 March
This has been discussed on blackboard and in some classes, but just to be sure everyone's gotten the message -- in a circular list like the one in this project, incrementing an iterator (iter++ or ++iter) that is currently positioned to the last data element should position the iterator to the first data element. Similarly, decrementing an iterator positioned at the first data element moves it to the last data element.
06 March
02 March
|
In addition to adding chunks, you will also modify the author's code to create a circular double linked list. In a circular list, the head's prev pointer is not NULL, but points to the tail. Similarly, the tail's next pointer points to the head.
Thirdly, you will improve the author's code by designing exception classes which will be thrown where appropriate in the linked list and/or iterator code.
Finally, you will implement a small application that will test your chunk list. That application is a simple version of "solitaire" -- a one-person card game. The solitaire game is described below.
So that we can see the progress of the game, some output is required.
For example, the "two of hearts" is displayed as 2h and the "Jack of clubs" as Jc.
To play this simple version of solitaire, the player first shuffles a standard
52-card deck of cards. All cards are then laid face-up (rank and suit showing)
side by side in a (very large) circle.
Beginning with the first card placed face-up, The player scans the circle of
cards in the direction they were laid.
When two adjacent cards have the same rank (e.g. both are 9s) or have the same suit
(e.g. both are spades), the pair of cards is removed. The player continues
scanning the circle of cards, removing all possible adjacent pairs.
The player continues to scan the circle until all cards
have been removed (the player wins) or until no adjacent cards can be removed (the player loses).
initialize an array 'a' by placing the 52 cards "in order" as above
seed the random number generator
for (size = 52 down to 1)
{
select a random number 'i' between 0 and size-1, inclusive;
swap a[i] and a[size-1];
}
Be sure to submit the answers to the project questions in plain text format.
Submit the files using the procedure given to you for your section of the
course.
If your makefile is set up correctly, you should be able to execute the command
make submit.
Submission Tools
There are a number of tools available to you to check on your submittal. It is
your responsibility to ensure that the submittal is correct and will result in
a successful compilation of your project. Do not wait till the last minute to
submit your files. Give yourself enough time to check that your submittal is
correct.
If you don't submit a project correctly, you will not get credit for it. Why throw away all that hard work you did to write the project? Check your submittals. Make sure they work. Do this before the due date.
Documentation for the submit program is on the web at http://www.gl.umbc.edu/submit/ . One
of the tools provided by the submit program is
submitls. It lists the names of
the files you have submitted.
Additionally, there are two programs for use only by CMSC-341 students (not
part of the UCS submit program). They are in the directory
/afs/umbc.edu/users/d/e/dennis/pub/CMSC341/
and are named submitmake
and submitrun. You can
use these programs to make or run your submitted projects.
The syntax is similar to that for submit:
submitmake <class> <project>
Example: submitmake cs341 Proj2 <parameter list>
This makes the project, and shows you the report from the make utility. It cleans
up the directory after making the project (removes .o and ii_files), but leaves
the
executable in place.
submitrun <class> <project>
Example: submitrun cs341 Proj2
This runs the project, assuming there is an executable (i.e. submitmake was run successfully).
Project grading is described in the Project
Policy handout.
Cheating in any form will not be tolerated. Please re-read the Project
Policy handout for further details on honesty in doing projects for this
course.
Remember, the due date is firm. Submittals made after midnight of the due date will not be accepted. Do not submit any files after that time.