In order to receive credit for this assignment, your solution must be submitted, using the handin command, by 8 AM, Monday, February 14th, 2005. I will zip your files and move them to my directory at that time. You may submit your solution before the deadline as many times as you like; only your final submission will be considered. However, for multiple submissions, it's best to use the same names for files, since only those will be overwritten by your submission.
The purpose of this assignment is to provide an opportunity for you to design C 1#1 classes in orthodox canonical form. Please be sure that you understand this form and how/when it works. You should design and implement at least two classes. The first class will abstract most of the details of printing text to an SDL screen and the second class will abstract the details of converting normal English spelling into leet or leetspeak. The design, construction and naming of these classes is part of the assignment. For example, I have named my two classes Screen and Leet, but you will likely use more appropriate names.
For the first class, you should begin by studying the SDL TTF example that we discussed in lecture where we print text to a screen. You must use SDL for this assignment and, as part of this course, you will become familiar with the lightweight SDL API. You can find the SDL TTF example at:
http://www.cs.clemson.edu/~malloy/courses/481-2005/examples/ttfdemo/easy/
Your class should move most of the details of printing
TTF text to an abstraction, called a class in C
1#1.
A consequence of removing
these details is that your main program
should become much simpler. For example the main program
in the following code will produce the canvas illustrated
in Figure
#include "screen.h"
using std::cout; using std::endl; using std::string;
int main( int argc, char* argv[] ) {
string message;
message = "Hello World";
Screen screen(400, 200, 16);
screen.blit(message, 20, 20);
screen.blit("Anakin Skywalker becomes Darth Vadar", 20, 40);
screen.blit("Darth Vadar become George Lucas", 20, 60);
screen.display();
SDL_Event event ;
while ( true ) {
if ( SDL_PollEvent ( &event ) ) {
if ( event.type == SDL_QUIT ) break ;
else if( event.type == SDL_KEYDOWN )
if( event.key.keysym.sym == SDLK_ESCAPE ) break;
}
}
return 0;
}
![]() |
The second class that you design and implement should have the proper constructors and destructors together with a method called, for example, convert, which takes a string in normal English and returns the leet conversion. Your constuctor(s) should initialize the conversion scheme that you use to convert from English spelling to leet.
Leet, or leetspeak, is named from the phonetic form of the word ``elite'', and is a cipher or novel form of English spelling. It is characterized by the use of non-alphabet characters to stand for letters bearing a superficial resemblance. Leetspeak is traditionally used on the Internet and other on-line communities, such as bulletin board systems. Leetspeak is commonly used by hackers and gamers.
To make it easy for the TA to grade the programs, we will all use
the same encryption scheme for English letters. I will provide
this scheme in a file, as part of this assignment. Your program
should work using this file, but we may make alterations to this
file and your program should be flexible enough to work with any
conversion scheme, as long as it is listed in a file. The
file contains an encryption for each of the 26 letters in the
English alphabet; please note that the leet translation of
a given English letter may be more than a single letter.
For example, the English letter ``W'' or ``w'' translates
in leet to \^/.
To test
your ability to read leet, consider the example listed in
Figure
.
In addition to the two classes that you write, you should include a main function that reads lines of English text from a file called data.txt. This file will contain lines of text containing no more than 60 characters and no more than 10 lines. We will test your program on a data.txt file of our choosing. Your main function, using the two classes, should be fairly succinct and straight-forward. You may design and implement more than two classes, but no less.
Finally, you must include a README file with your submission. Your README file should identify you, your name, the assignment number, a few sentences describing your assignment, and a listing of what is different about your assignment, what you might have had trouble with, and anything extra that you might have included in your assignment that was not part of the specification. A Makefile might also make it easier for the TA to grade your assignment, but it is not required for this first assignment.
Thus, you should include in your submission:
When you submit your program, use the handin command. Our variation of 481 is Section 2; thus, the handin command for the first assignment would be:
handin.481.2 1 *