|
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 3 |
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
So you have created an Enigma machine that enciphers and deciphers uncrackable messages. Good Job! (If you haven't gotten the Enigma to work, you must get it working before proceeding on this project.) Notice that the output of a deciphered message looks something like:
theterrapinscoresatmidnightWhile this is acceptable for most cryptologists, we do not want important people like the president of the college to have to read such a long crunched string. We would ideally like a parser that can divide this sentence into words. This will be the goal of Project 3.
The parser should be fast and accurate. Speed is of the essence which is why we will be implementing our dictionary of words as a Binary Search Tree, allowing us to find the words in the dictionary in O(log(n)) time (assuming a height-balanced tree). Furthermore, accuracy is crucial. We do not want President Mote to receive "The terrapins' core sat midnight.". All of the preceding words are valid English words. We would, however, prefer for the president to read "The terrapin scores at midnight."
Make sure your Enigma from project 2 is working correctly
and can encipher and decipher with:
There have been a few updates to P2.
Make certain that you have made the changes
to
Enigma must be working before proceeding because your
output from Enigma will be the input to your parser.
Update testCoder.cpp and testEnigma.cpp.
Create Entry.cpp (the nodes in the BST) and Bst.cpp
Create testEntry.cpp and testBst.cpp
Test these thoroughly before proceeding.
Create Dictionary.cpp and testDictionary.cpp
It reads from a file: dictionary.txt
Correct file reading functions are expected.
Hardcode the file name that Dictionary reads as
"dictionary.txt".
You can test it on your own dictionary file.
Create Parser.h, Parser.cpp and testParser.cpp
Parser works on a deciphered message without any blanks
Note: we will still test your Enigma with letters removed
from the wheels but the message you parse will not contain blanks.
New
Parser takes the deciphered message, such as "wearehear", and
locates words in the Bst to insert blanks between the words.
Let's assume that the following words are in your dictionary.txt:
You start looking for the first letter 'w' in your Dictionary.
You find "we" and "wear". Assume you choose "wear". Keep this word until
you have examined the next few words to make certain you are 'reading'
the message correctly. The next letter in the message is 'e'. So in your
Dictionary, you look for the word "e". It is not there, so look for the
word
"eh". There is no such word and no word that begins with "eh" so you must
backtrack
to the previous word and select a different one, "we" (instead of "wear").
Then begin again with "we" and look for words that begin with "a" - "a" and
"are". If you choose the wrong one, again you will have to backtrack.
Continue
to do this until you have only words from your dictionary.txt in your
message.
You might have to backtrack through several words to get the message
separated correctly (i.e. containing only words in the Dictionary.)
Comment your Parser code very well, stating what heuristic you
followed to successfully separate the words.
Create ConstIterator.cpp and testConstIterator.cpp
This is a constant iterator that is bidirectional
whose purpose it is to walk from a node in the tree to the
next node in the tree, beginning with the node with smallest
value to the node with largest value. It can traverse both
forward (++) and backwards (--).
| See the class syllabus for policies concerning email
Last Modified: Monday, March 17, 2003 |
|
|
|
|
|