01-02-2014

posted Jan 2, 2014, 7:57 AM by Samuel Konstantinovich   [ updated Jan 2, 2014, 11:35 AM ]
Goal: A lab in 3 acts:
Complete Act 1 and Act 2 by tomorrow. 

Act I: Revisiting ROT13 and ROTx

Mr. K: "Write a Rotate command line program that you give a string, and a numerical offset. The program rotates the characters by offset places in the alphabet, z wraps around to a, and capitalization stays the same."

Annoying student: "What?"

Mr. K: "Can you rephrase the question?"

Annoying student: "Can we have some examples?"

Mr. K: "Sure!"

$java Rotate abz 1  
bca
$java Rotate aBz 3  
dEc
$Rotate "Hello World" 1  
Ifmmp Xpsme


Annoying student: "Is that all? We did that in intro term two..."

Mr. K:  "You will later improve the rotate command. If there is no number provided, your rotate command will decode an encoded string. This isn't as hard as you think."


Act II: Return of the Poet 

Mr. K:  "Write a program that reads a text file, and counts the frequency of each letter (ignore case)"

Annoying student: "That sounds useless"

Mr. K: "It is quite useful. You will use this program to analyze English text to give you an idea of which letters appear most frequently. You will take a large text and see which letters are most common. In any sufficiently long English text, the frequencies would be similar. This can help you in act III. We will use a body of text from project gutenberg  http://www.gutenberg.org "

Annoying student: "Will different books give different results?"

:::Something Shakespeare this way comes:::

Mr. K: "Absolutely, A list of chinese names will have a lot of L's and X's. ... We will all use MacBeth so we all get the same frequencies and can check if we are correct. Use the resulting frequencies in the next part."


Act III: Fall of the L337 encryption algorithm

Mr. K: "You can use the frequencies to determine how many times the letters were shifted over."

Annoying student: "Really?"

Mr. K: "Of course."

Annoying student: "How?"

Mr. K: "Why don't you figure it out?"

Annoying student: "Because I am lazy and want you to tell me answers to memorize so I don't have to think!"

Mr. K: "While I applaud your honesty, that doesn't change the fact that you will have to think about it more. Any questions?"

Annoying student: "Why isn't this play in iambic pentameter?"

Mr. K: "Because I am not a playwright and even if I were: I prefer iambic tetrameter. Now try to figure out a way to make this work"

Comments