Thursday, September 2, 2010

Holiday Assignments - Some *** time required

It seems that the job of a uni-student never abates until the exams are over - indeed, the term "term break" is really a misnomer the further up you get. At least the work gets more fun at the same time (usually) ;)

The university rules state that they aren't allowed to set exams or due dates during the break (yay!), but sadly do not stipulate anything about either side of said break.

Over the past week and a bit, I've been slaving away at three assignments due on the same day at the end of the first week back. Unfortunately, this comes at the expense of not being able to have spent that time on Blender instead! 'Time required + 1'.


When one of these assignments was handed out, the lecturer pronounced the following words (with a semi-grin on his face):
You are advised to start work on the assignment early... some computation time is required.
For the uninitiated, a computer scientist mentioning "computation time" being required, and in the same sentence as "early" is not a good sign.

It wouldn't be that bad if "early" wasn't mentioned; then that "computation time" difference might be just 300ms vs 259ms for a limited number of runs. But when you factor in that the assignment talks of automated statistical tests being run four times with increasing powers-of-ten number of samples, things become worrying.

And then if that wasn't worrying enough, consider the shock you'd get when trying to go for the "accurate" approach that you though would get optimised by the interpreter that does other fancy stuff like this quite well, only to realise upon running it that actually the running times would increase exponentially, becoming unusable after generating 30 samples. At least from this process I got a good benchmark test for what the "correct" output should look like, which turned out to be invaluable in catching a case I'd otherwise have sidestepped: calculating mod of a negative number! (haha to anybody who wouldn't have ever known what hit them)

The moral of this lesson: (Computation) Time required + 1


Now we turn to another assignment. In theory it shouldn't have been too difficult, right? Add one or two features to a language parser, with the source code for it given already, course notes describing how the language works, and no need to get the compiler for those features working yet.

Well, yes and no. Figuring out the syntax is easy - anybody who has programmed in a few languages for a while will have their preferences and ideas on what they'd love to see. However, being able to understand the provided code enough to extend it - quite a challenge once you really look carefully.

It's kindof interesting seeing this code, as it's one of the few examples of K&R C you'll still find out in the wildness of the internet these days (some of the other examples you'll find on under the "neogeo chest", specifically under Ton's folder). It's also written with hardly any indention, multiple statements per line in some places, and no blank lines anywhere! Oh, and the best part are the single letter globals used throughout... it's quite amazing really.

Then again, considering that it was ported from some Pascal code (I have my suspicions that this code is actually an automatic translation of that said code), then some features are less alarming. Still, from a pedagogical standpoint, I guess this is really quite ingenious, as most students will have to do a bit of recoding to make sense of what's there, and in the process learn how to do this stuff without having to be stuck trying to figure it all out from scratch, but without it all being done already.

From this we see: (Recoding) Time required + 10


The third assignment is a different type of beastie: death by proof.

Let assignment, A, consist be the set of questions, Q, where proofs, p1,p2,...,pn shall be required.

Consider the statement...

... several days later ...


... another few days ...


... another few days still... wait, the assignment's due in a few minutes!

Prooven. Death by proof: (Bottomless pit) Time required + infinity


Anywhoo... this is just a little holiday sillyness while chugging through the parser code and brewing another "un-proof".

No comments:

Post a Comment