Vigenere Cypher

So I’m trying to convert my Caesar Cypher into a Vigenere Cypher. The difference being that Vig uses a shift word instead of a single shift number. For example:

Caesar Cypher:

– if the shift number is 2, and the secret message is “A B C” then the encrypted message would be, “C D E”. 

Vig Cypher:

– each letter in the shift word has a corresponding number. A = 0, B = 1, C = 2, etc. SO lets say our shift word is “cat”. That would mean our shift sequence is: 2 – 0 – 20. So if our message was “New York”, the encrypted message would be, “Peq Aolm” (pending I counted through my alphabet correctly). The shift sequence of “cat” is repeated until the message is fully encrypted. 

So I cant figure out how to implement a shift word, with its corresponding shift number, and then iterate over a secret message using the proper sequence of numbers. I’m at a loss to figure out how to iterate over an array with another array.



Hail Caesar!

So I figured out how to make a Caesar Cypher work! It hit me this morning.

First, I dont need a second array. Or an array at all for that matter (unless you count argv). Once I wrapped my mind around how you can add an int to a char and change the actual char it was simply a matter of iterating over each char, moving it by its shift, and then printing it one by one. I had to throw in a set of conditionals to discern between upper and lower case letters but other than that its pretty simple. As per the instruction of the problem set I had to leave the non letter chars alone. 

I’ve uploaded it to my dropbox. Take a look here: 


I’d gladly take any ideas on how to better manage those conditions. They look a little ugly to me. I feel like an an artist who has yet to learn how to draw more than stick figures. Meh, it’ll come with time. 

Now I need to figure out how to implement a shift word instead of a mere number. Yeessss.


Long work weeks.

Last week I worked out of town all week. This week I’ll be pulling a two week straight stint. Then I have drill. Then another week. Ugh, it goes and goes.

On an upnote, I’ve been pretty good about getting up and studying. Lately though I havent produced much because I’ve been watching a lot of lectures. So now I’m tacking problem set 2.

The first program was a simple one that required me to print on the screen all the lyrics to “This Old Man.” 

This old man, he played one
He played knick-knack on his thumb

and so on. Its nothing special but its meant to be a first go around in using arrays. The awesome part about this program is that it complied and worked on my first attempt. Woo! I just had to add a few \n to make it format properly.

The other problems have me creating a Cesar Cypher. I have yet to really get this one down on account that I’m a little foggy on a few points.

– how to convert a char to a corrosponding ASCII int. From what I understand, you can typecast it and it’ll do the legwork. 

– from there I want/need to know how to initialize an array thats empty waiting to be filled. Can I even do that in C or do I have to know its size ahead of time? 

The next problem set calls for a Vigenere Cypher. For the uninitiated, its similar to a Cesar Cypher but instead of a single number shift it uses a shift word. Each word has a corresponding number and the words are shifted according to that number. Since I havent worked through the Cesar Cypher I havent applied much thought to this problem yet. 

So thats that for now 🙂


Accidentally Over Ambitious (Part 2)


The above link goes to my CS 50 Dropbox folder that has the three wee programs I had to write.

Pennies.c asks the user for how many days in the month and how many pennies they initially have. It outputs how much those pennies add up to when treated exponentially. I need to learn how to include commas in large numbers. The course doesnt say it explicitly, but I believe the point behind this program was to experience how inaccurate computers really are. Its all bits and bytes and this is something to sit and go over with Dr. Dave. It’s somewhat foggy to me. I was also surprising to learn that C does not have an operator for exponentiation. I later learned that if you use the math.h library you have the pow function.

Greedy.c asks the user for how much change is due. It then computes the fastest way to reach that number with the least amount of coins. Starting with quarters and moving to pennies. Its pretty easy conceptually especially if you use a modulus operator but for some reason I cant get it to compile. Help.

Lastly, chart.c asks for how many specific types of sightings occurred between the sexes. It then needs to take that input, calculate it to a percentage of 80 asterisks (*) printed on the screen to act as a graph. Its pretty silly. The formula I came up with/came across doesn’t really seem to work. It prints all the * on the same line.

Overall, it rocked. It was a much more reasonable problem set for an introductory class than MIT provided. Also, I’ve taken to C much easier than I thought. Although its freakishly annoying when I forget something like a simple “;”. The copious documentation (and the fact that C apparently hasnt changed at all for about 15 or so years) helps. I’m curious to learn the actual differences between C and C++, C#, and Objective-C. Are they like brothers from the same mother, or cousins far removed from a distant sire and constantly seeking to usurp the throne of the other… oh wait, I’m mixing my studies with my enthusiasm for the new season of Game Of Thrones.

Speaking of which, I’m tired. Off to relax world.


Accidentally over ambitious (Part 1)

I find myself with a few min to post an update so why not.

So I’ve spent past few days heavily working on Problem Set 1. I’ve gotten acquainted with C as well as using Terminal or a command prompt to do things. The problem set had three programs assigned. I’ve successfully completed all three but two of them have some bugs (one that breaks it, the other just doesn’t output right). BUT it does compile!

I’ll post them later this evening for inspection. I’m debating on just including the code here or linking to somewhere I can store files and have them freely accessed. Any suggestions on such a place?

The big thing I realized is that I was being a bit overly ambitious. I thought that (acfording to the course schedule) this problem set was due after week one. It’s actually due at the end of week two. Week two also covers a lot of topics that help in the problem set. No wonder I had some headaches…

More to follow


CS 50 Round One

So I picked up my study with CS 50 on week 1 (it starts at 0). I had already watched the previous weeks lectures before and so I picked up where I left off. We covered an introduction to C and how to use and interact with a marvelous creation: VirtualBox.

At Harvard, CS 50 is a massive class. Somewhere around 500 students I think. To ease standardization issues Harvard created an OS that works inside your OS. In short, my Mac OS X is fooled into thinking its running any other program when it’s actually running another OS that thinks it’s the main OS. Quite neat.

The OS that it uses is a Linux derivative (I think Fedora) that Harvard adapted. It comes with an IDE (code editor) that Harvard developed. Here is a view of it as it sits on my laptop: Image

Overall I’m stoked! Harvard’s CS 50 is put together much better. Everyone should check out their website at :


I also completed the first problems set. I had to use a program called Scratch to create a simple program. Scratch (funny enough for my situation) was created by MIT to help people learn the principals of programming. Its largely intended for elementary, middle, and highschool use. However its pretty fun and it helps get the ideas across. As far as I know, its the only time we actually use Scratch during the course.

Anyway, the first wee program I had to put together had to include:

  1. Your project must have at least two sprites, at least one of which must resemble something other than a cat.
  2. Your project must have at least three scripts total (i.e., not necessarily three per sprite).
  3. Your project must use at least one condition, one loop, and one variable.
  4. Your project must use at least one sound.

I put together a Frogger type game that you can actually play here:


Lastly, I figured I’d give everyone a view of the actual Scratch program:


So thats the fun I’ve had lately.



Rethinking my Strategy

So up to this point I have relied on MIT’s OpenCourseWare for my instruction. On a scale of 1 to 10 I would give it an 8. Its very good instruction and very well put together but it has a rather critical flaw: its from MIT. 

I dont personally know what kind of student they think they are recruiting, but they must believe they are some sort of savant genius. They say in the syllabus that this is an introductory course but they do not tell you what other non Comp Sci classes you should take… like copious amounts of math before you begin. But most of all, the biggest flaw in their instructional method is how they assign a problem set and then teach you how to do the problem on the day it is due. Personally, I dont see much of a need to take a class when they obviously think I can learn the material before they teach it to me. 

Its incredibly frustrating when they assign a problem set that practically requires one to have access to other students in person in order to solve it. It is a problem when the only way to solve a problem is to collectively bang one’s head against a wall with other tortured souls – especially when the class is given as an online instruction. This problem exponetially increases for me because I am constantly fighting the feeling that I have fallen behind in understanding. 

I think one of the core problems in the class lies in that it is intended as an introduction to computer science for computer science majors. They assume a particular level of nerd and the availability to work with other like minded nerds to succeed. 

Were I taking the same class in person I wager my results would be different. Yes, I am a nerd, but I dont have any other nerds doing the exact same course as I. Therefore I have nobody to collectively work through my frustrations with. I do have the secret weapon of a Jedi Master as my guide, but I really dont like running to daddy every time I have a question (which is often). I prefer to figure it out on my own or with a peer. I think a mentor’s job should be to keep me within the bounds of my study and answer the big questions, not to be bothered with every single detail. 

So, I think I may have to do something slightly drastic. Pending approval from Dr. Dave, I think I am going to restart my instruction with Harvard’s CS 50 course. I’ve watched a number of the lectures in the past as well as done some of the assignments and they are prepared MUCH better. The problem sets are more regular and more reasonably constructed. They are more of a, “Today we learned about loops. Construct X program with Y number of loops plus A, B, C elements,” vs. “Today we learned about loops. Construct a program to play hangman with the computer using semi advanced calculus skills before we ever teach you how.” CS 50 also has the added benefit of being targeted not only as computer science majors, but to everyone. The majority of students that take CS 50 are not Comp Sci majors and never intend to be. They merely want to know a bit more about computers. 

I hate to do this sort of thing because I feel like I am running away from a problem. But I am honestly hitting a wall with the course and its because I feel lost. Not because I havent paid attention, but because they expect me to understand concepts and skills that I have had no exposure to. 

In addition to rethinking my istructional strategy, I need to become more ballanced in my math vs lecture time. I spent all of my study time last week doing math on Khan Academy. It was freaking awesome. But then I realized that I had forgotten about my actual mission: learning to program. 

So I think I’ll break it down as follows: M, W, F mornings, and Calculus on T, TH mornings. I’m not sure how I’ll break things down in the evenings, but most of my study time is in the morning anyway. 

I really dont like the idea of stepping away from Python because I’ve grown to like the language, but I will endure. 

Any thoughts out there?