To see the 2008 challenge, please visit the 2008_lolcode_challenge page.
N-Squared is pleased to announce the results of our 2009 PIET Challenge. Congratulations go to Alex Gibson for his excellent PIET program:
This solution used Zellers Congruence, and the actual PIET program executes around the edge of the image, while the bulk of the image - the Mario character, is for looks.
Alex happened to be the only entry this year - so congratulations to Alex for his efforts. Next year we may look to make the competition a little easier.
As part of our interest in supporting local IT talent, N-Squared Software has run a second programming challenge for Massey University students. This challenge was designed to be completed individually, in your own time. It was not a timed or group challenge. The challenge can be read about below.
2009's challenge offered something to really exercise those “little grey cells”. This challenge should take a few hours to complete. For those who take this challenge on, we hope you find it a pleasant escape – a gentle diversion from the more mundane demands of this tired, worldly existence.
Prizes were paid in the following amounts:
| First Prize | Second Prize | Third Prize |
|---|---|---|
| $200 | $100 | $50 |
All prizes in New Zealand dollars.
In this modern world, having timely and accurate access to a mechanism for determining the current day of the week is critical. Work, school, university, meetings and sports events… all of these take place on a specific day of the week. An error of even just a single day could hurl your entire schedule into disarray.
Piet is a a programming language in which programs look like abstract paintings. The language is named after Piet Mondrian, who pioneered the field of geometric abstract art.
| |
To test functionality, we will execute your ”.ppm” program picture file from the command line using the npiet interpreter.
$ npiet dow.ppm ? 2071 ? 3 ? 15 0
Your program must prompt for three integer values, which we will enter in the following order:
Your program must then print out the day of week. For simplicity, we will accept the day of week being printed as an integer in the range 0 = Sun, 1 = Mon, etc. through to 6 = Sat.
In the example execution above, the program has computed that March 15th, 2007 is a Sunday.
Please send your submission to:
The following must be provided in your submission:
Please note:
Marking will be based on the following:
The maximum possible score is thus 12 points. We will look for opportunities to assign you “Extra Mile” points, but you might want to help us by explicitly mentioning features which you believe are worthy candidates for bonus points.
Note that for the purposes of these rules, “we” and “us” refers to N-Squared Software and agents acting on their behalf. “you” and “your” refers to the person who submits an entry for this challenge.
The challenge organisers are:
The specification of Piet can be found at David Morgan-Mar's Piet Home Page.
The npiet home page provides a command line interpreter named “npiet”, and the “npiet-edit” graphical image editor. We will use npiet when evaluating your solution.
We used “npiet-edit” when creating our solution, and it certainly makes the colorization step very much easier. The “npiet-edit” program is a Tcl script. Under ubuntu, “apt-get install tcl”. Under other operating systems, try ActiveTcl.
TimeAndDate provides an on-line calendar. Note also that fortunately, Leap Years in the 2000 to 2099 range all obey the “leap year if divisible by 4” rule.
Having written a solution ourselves, please take our advice that you can make it significantly easier on yourselves by choosing the right approach.
Our recommendation is that you first look at some of the sample Piet programs/images available on the net, then maybe create a very simple program yourself with the editor. But then we strongly recommend that you put the graphical editor aside and plan your approach in a structured fashion.
We found it very helpful to first code up our algorithm in a scripting language (Perl in our case). We ran the script with some dates to prove that the results were accurate.
Next we translated our program as a series of Piet stack-based commands and again tested them in our scripting language. We re-ran the same test dates to ensure that we had correctly translated the algorithm into Piet steps.
The final step is then to use the graphical editor to paint the appropriate color instructions into the program image. Be sure to leave yourself enough room. Our solution used a 32×32 pixel image. Depending on your algorithm, you may require more or less space. But in general, giving yourself enough room will increase your chances of not having to re-start the coloring process.
Finally, note that “npiet” supports a maximum integer value of 2^31. Bear that in mind when choosing your algorithm.