The fun(?) side of programming

Programming is often regarded as a very complex, hence very serious, task by non-programmers. Is that true? In most cases, that is the fact. A programmers always have to dealing face-to-face with many problems. Handling never ending requirement, creating an algorithm to solve problem, fixing little bugs that hidden inside the programs, maintaining old programs, keeping up to date with new technology, and the list is still long. There is no room for a little fun right?

Or not.

There is a lot of fun in programming. The joy of programming is to solve a problems or challenges. Yes, the word fun in programming is closely related to challenge. No challenge means no fun at all. For this particular reason, there are so many website that offer many problems to solve by curious and determined programmers.

Many type of challenge is unique and creative. The theme usually simple but to solve it one will need a good understanding in programming concept and programming language features. Are you ready to take the challenge? Below is a list of some creative challenge you can try :).

Create programs with minimum amount of code

The most notable contest with this theme is Perl Golf Apocalypse (PGA) and JS1K. PGA is perl coding competition with the objective of solving a basic programming task with the smallest perl code possible. In JS1K, a programmer can submit JavaScript code that complete any task, with size less than one kilobyte.

To complete this kind of challenge, one must have a deep understanding of the feature of programming language and use the most simple method to solve the problem. Create a chess with AI with a code less than one kilobyte is not an easy task, even for experienced programmer.

There is also a challenge to create the shortest hello world program possible. The winner so far is Jon Skeet. He even create a brand new programming language with purpose solely to print hello world. He only need one character to print it. “Arguably I could have designed it to only accept an empty file as input, but that would have been silly (source)” he says. He even have his own Jon Skeet Facts.

Create a very long and complex program to complete very simple task

How hard is to build a program that print “Hello World” to screen? A very simple task. Hello world program is the first program created for most of programmers. This program can be completed in less than five minute, even if you are just start learning your very first programming language.

Some people in stackoverflow.com give you a challenge to code a hello world program as palindrome. It’s mean your code can be read the same way in either direction. It is no easy task for a programmers. Another person ask for the longest hello world program. Try to read the code below, in chimpanzee voice :

#example that prints Hello World!
Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook. 

That is a hello world program written in Ook programming language. It’s real and it’s works perfectly. In case you want to know, there are 282 Ook words written in that code. Another notable submission is code in Chef and Shakespeare programming language.

In perl community exist Just Another Perl Hacker (JAPH) challenge. Perl programmer is compete to create most creative way to create program that print “Just another Perl hacker,” in their signature. The code then embedded in their signature. You can see the example in JAPH Wikipedia page. Make sure you see the camel one ;).

Obfuscated Code Contest

A good code is a code that easy to read and easy to understand. But there are some situation when you want to protect your code by making it hard to read. This kind of code is called obfuscated code. Something like this :

char*M,A,Z,E=40,J[40],T[40];main(C){for(*J=A=scanf(M="%d",&C);
--            E;             J[              E]             =T
[E   ]=  E)   printf("._");  for(;(A-=Z=!Z)  ||  (printf("\n|"
)    ,   A    =              39              ,C             --
)    ;   Z    ||    printf   (M   ))M[Z]=Z[A-(E   =A[J-Z])&&!C
&    A   ==             T[                                  A]
|6<<27<rand()||!C&!Z?J[T[E]=T[A]]=E,J[T[A]=A-Z]=A,"_.":" |"];}

If any lecturer ask the students the output of that program, I’m quite sure all the students will fail.

By the way, there are three obfuscated code contest : International Obfuscated C Code Contest, Obfuscated Perl Contest, and International Obfuscated Ruby Code Contest. Below is the goal of International Obfuscated C Code Contest :

  • To write the most Obscure/Obfuscated C program under the rules below.
  • To show the importance of programming style, in an ironic way.
  • To stress C compilers with unusual code.
  • To illustrate some of the subtleties of the C language.
  • To provide a safe forum for poor C code. :-)

This is one of the submission. The program is used to calculate the value of pi:

#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
        _-_-_-_-_-_-_-_
            _-_-_-_
}

Another submission can be seen in ioccc website.

That’s it. A programmer is able to having fun too, but in different and challenging way. I’m quite sure many other creative challenge exist. If you know any, you can tell us in your comment. Thank you and have fun in code :).

This entry was posted in Computer Science. Bookmark the permalink.

6 Responses to The fun(?) side of programming

  1. zmhtwqgc says:

    I really enjoy a good cutting edge zmhtwqgc. They have been nice and genuinely great-looking.

  2. A “Hello World” program has become the traditional first program that many people learn. In general, it is simple enough so that people who have no experience with computer programming can easily understand it, especially with the guidance of a teacher or a written guide. Using this simple program as a basis, computer science principles or elements of a specific programming language can be explained to novice programmers. Experienced programmers learning new languages can also gain a lot of information about a given language’s syntax and structure from a hello world program.

  3. I actually still can not quite believe I could possibly be one of those reading the important recommendations found on your website. My family and I are seriously thankful for the generosity and for offering me the chance to pursue this chosen career path. Appreciate your sharing the important information I acquired from your web page.

  4. Great post. I was checking constantly this blog and I’m impressed! Extremely useful info specifically the last part :) I care for such info a lot. I was seeking this certain information for a long time. Thank you and good luck.

  5. Strongly suggest adding a “google+” button for the blog!

  6. Luz Paree says:

    I just want to mention I am just all new to blogging and truly savored your web-site. Most likely I’m want to bookmark your site . You certainly have good posts. Cheers for sharing your website.

Leave a Reply

Your email address will not be published. Required fields are marked *