knottythots label

26

Line Rider - Beta

Found this pretty cool toy on deviantart called Line Rider

Please click “Play”. Don’t come back to me saying you “saw the fancy text” -__-”

There’s an updated and better version but requires you to install Microsoft Silverlight first.

At this moment, the video below is the highest rated one on youtube. There are many others that look better to me though. Some have colour and some have even more interesting tracks.

17

The Programmer’s Game

Filed under: Humour, Programming

A joke I came across on the internet. Enjoy!

A Programmer and an Engineer are sitting next to each other on a long flight from LA to NY. The Programmer leans over to the Engineer and asks if he would like to play a fun game. The Engineer just wants to take a nap, so he politely declines and rolls over to the window to catch a few winks. The Programmer persists and explains that the game is real easy and a lotta fun.

He explains "I ask you a question, and if you don’t know the answer, you pay me $5. Then you ask me a question, and if I don’t know the answer, I’ll pay you $5". Again, the Engineer politely declines and tries to get to sleep.

The Programmer, now somewhat agitated, says, "OK, if you don’t know the answer you pay me $5, and if I don’t know the answer, I’ll pay you $50!".

This catches the Engineer’s attention, and he sees no end to this torment unless he plays, so he agrees to the game. The Programmer asks the first question "What’s the distance from the earth to the moon?"

The Engineer doesn’t say a word, but reaches into his wallet, pulls out a five dollar bill and hands it to the Programmer.

Now, it’s the Engineer’s turn. He asks the Programmer "What goes up a hill with three legs, and comes down on four?"

The Programmer looks up at him with a puzzled look He takes out his laptop computer and searches all of his references. He taps into the Airphone with his modem and searches the net and the Library of Congress.

Frustrated, he sends e-mail to his co-workers — all to no avail. After about an hour, he wakes the Engineer and hands him $50.

The Engineer politely takes the $50 and turns away to try to get back to sleep. The Programmer, more than a little miffed, shakes the Engineer and asks "Well, so what’s the answer?"

Without a word, the Engineer reaches into his wallet, hands the Programmer $5, and turns away to get back to sleep.

18

Iterative vs Recursive

Filed under: School, Programming

There are quite a few things taught in this semester that we have to know because its in the exams but not recommended to use in real life.

This semester, the programming language taught was C++. Things like continue, break and others were discourage from use unless necessary. The major portion that has very heavy weightage for both modules this semester is recursion. At the same time, the lecturers are telling us how this is discouraged in the real world. Ironic. I understand we have to learn this but why the heavy weightage if its discouraged. It’s like teaching <font> tags to beginners then telling them they should never have to use it.

Using iteration over recursion is usually an obvious choice. Not only is it easier to understand, it takes lesser time and is more efficient as compared to recursion.

Of course, recursion is not without it’s merits. The lecturers like to put them as "simple and elegant". In a more practical sense, there are times where things can’t be accomplished using iteration. I’ve also read that recursion reduces the length of code but I feel that is pretty subjective. Depending on the algorithm, codes rewritten for recursion may end up being more complex and longer. One of the major disadvantage is of course the problem of causing a stack overflow. The solution to this is tail-recursion calls which is a variant of the versions that we are taught (non-tail). Tail-recursion calls do not require additional stack space.

Also, I came across an article from Microsoft containing a short segment on comparing the two. Most I found were in favour of iteration. This is one of the few that have stronger supportive points for recursion over iteration.

Object-orientated language or no, I’m still sticking with iteration despite having it’s performance problems fixed simply because the code will be simpler to understand. Besides, things are going towards the way of object-orientated programming in which recursion has a slight disadvantage.

Darn the heavy weightage on recursion. It’s good to learn and know how to at least. Every programmer has his or her own style but this is almost like doing hard-core training for us to be functional programmers.

I wish I could say "To each his own" but the university isn’t letting me. Sigh.

20

Protected: Debugging Games

Filed under: Personal, Games, Programming

This post is password protected. To view it please enter your password below: