Extra Challenge Problem for lab 3

Due 11:59pm Tuesday, September 22
(submit with the rest of your lab 03 solutions using handin21)

This is NOT a required part of lab 3. This is an problem that is designed to really challenge you, and you should not attempt it until you have completed the other problems in lab 3.

We think this is a difficult problem. We do not expect that students should be able to solve it at this point in the semester; the solution requires using only things you know at this point, but the algorithm is a bit tricky. Therefore, if you try it, and don't get it, that is fine. What is important is that you can successfully do the regular problems in the lab 3 assignment.


This problem extends the cyclic cipher problem in the following way:

Here are some runs of a working solution to give you an idea of how this encoding should work:


$ python super_encoder.py

This program encodes a phrase using a cyclic cipher
Enter a phrase: Hello There agent 007...
Enter a shift value: 3
The encoded phrase is Khoor Wkhuh djhqw 33A...


$ python super_encoder.py

This program encodes a phrase using a cyclic cipher
Enter a phrase: AZaz09
Enter a shift value: 6
The encoded phrase is Gfg56F

$ python super_encoder.py

This program encodes a phrase using a cyclic cipher
Enter a phrase: AZaz09
Enter a shift value: -3
The encoded phrase is 7WXwx6

$ python super_encoder.py

This program encodes a phrase using a cyclic cipher
Enter a phrase: AZaz09
Enter a shift value: 20000
The encoded phrase is k9AZaj

$ python super_encoder.py

This program encodes a phrase using a cyclic cypher
Enter a phrase: This is really cool!  I totally get this mod thing, 100%
Enter a shift value: 5
The encoded phrase is Ymnx nx wjfqq3 httq!  N ytyfqq3 ljy ymnx rti ymnsl, 655%