CS 246 Assignment 9
This assignment is to write obfuscated C. Write the ugliest, least readable, C that you can imagine. For inspiration you might look at IOCCC. While you can be inspired by those examples, you need not follow the IOCCC rules. Be inspired by those rules; some of them certainly do not apply.
The important part of this assignment is to have have fun. (See the grading standards below.)
Grading
Your assignment will be graded as follows:
- Code: 40% -- if I can figure out what it does without any aid, you get less. If it does not compile, less. If it fails at runtime, less. Everyone should get full credit here.
- Writeup: 45% -- I should be able to understand your code after reading the writeup.
- Readme: 5% -- mostly here should be specific directions for compiling and running.
- Making the grader laugh: 10% (or at least smile)
There will be no bonus points for handing this in early.
Specifics
Write a block of code in the style of the obfuscated C code competition. It can do anything. Some constraints:
- It must be short. Ideally the total code length is under 500 characters. It can be more, but do not exceed 4096 characters. (If you really need to, you can exceed 4096 characters; if you do you should justify that in your writeup.)
- The code must do something. It could be that the something is quite trivial, but it must do something. A classic in OCCC is to draw some sort of picture
- The code must be your own.
- You must include a detailed writeup of exactly what your codes does and why. I would expect that this writeup will be 5 to 10 times longer than the code (or more).
- All thoughts of good coding style should be forgotten. Single letter variable names should dominate; and if not single letter, then misleading names. Good style is about readability which is the exact opposite of this task. (Pointer arithmetic is excellent for obfuscation.)
- The code must not require any file other than itself to do its task. For instance, you may have the code read a file from standard input, but the only file you can have it read is itself.
- Ideally, I should not be able to figure out how you code works without reading the detailed writeup.
Suggested Approach
- Come up with an idea for what you want your code to do
- Write code to do that using good-ish style.
- Repeat:
- Make a copy of your current code
- Obfuscate it a little bit
- Note down what you did
- Test you code to ensure it still works
I make this suggestion based on my own experience; it is really hard to debug obfuscated code, even when you are the one obfuscating it.
What to Hand in
- The usual README including instructions on how to run your code
- A reflection on what went well / poorly.
- Your code
- Your detailed writeup of what your code does and why. This writeup can be included within you readme, or it may be a separate file. If separate, it should be either text or PDF. For instance you might use PDF because it allows you to include diagrams and pictures.