The N-Squared 2009 Piet Challenge

To see the 2008 challenge, please visit the 2008_lolcode_challenge page.

Results

N-Squared is pleased to announce the results of our 2009 PIET Challenge. Congratulations go to Alex Gibson for his excellent PIET program:

{{:competition_2009_alexgibson.png|

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.

Introduction

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

Prizes were paid in the following amounts:

First Prize Second Prize Third Prize
$200 $100 $50

All prizes in New Zealand dollars.

Problem Description

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.

:!: **Your challenge is to write, in the Piet language, a program which will compute the day of week for any given date in the years 2000 to 2099 inclusive.

Running the Program

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:

  • 4-digit Year-With-Century (range 2000-2099 inclusive).
  • Number of Month (range 1-12 inclusive).
  • Day of Month (range 1-31 inclusive).

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.

Submission

Please send your submission to:

The following must be provided in your submission:

  • Image-format program “source code” (.png or .ppm file preferred).
  • Document describing the algorithm used in your program.
  • Your name and contact details.

Please note:

  • Only full time 2009 Massey university students are eligible for prizes.
  • The submission deadline is 5pm NZDT, Monday the 31st of August 2009.
  • All winning contestants will be notified by the 7th of September 2009.
  • The competition results will be posted on this website by this date.
  • All prizes must be collected in person in Palmerston North.

Marking Criteria

Marking will be based on the following:

  • [1] Compliance To Input & Output:
    • Does the program obey the specified input/output rules.
  • [4] Accuracy:
    • Eight dates will be tested, with 0.5 marks for each correct result.
  • [1] Unique Algorithm:
    • A bonus mark will be allocated if your algorithm is unique among submissions.
  • [2] Algorithm Description:
    • Your algorithm documentation must clearly describe how your program works.
  • [2] Aesthetic Visual Appearance:
    • Does your final image look appealing and/or interesting? Our kids will decide.
  • [2] Going The Extra Mile:
    • Bonus points for “doing extra work”, or “a really nice solution”. Two points max.

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.

Rules

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.

  • Only full time 2009 Massey University students are eligible for prizes. You must hold a current Massey University ID card.
  • The judges decision will be final and no correspondence over the final decision will be entered into.
  • Employees of N-Squared software and their immediate families are not allowed to enter.
  • You may enter the challenge only once, though you may submit a program as many times as you like. We will consider your last submission only.
  • We reserve the right to exclude any person from participating in the challenge on reasonable grounds.
  • We reserve the right to refuse to award any prize to an entrant who we decide (at our sole discretion) has violated the Rules, gained unfair advantage in participating in the promotion or won using fraudulent means.
  • By submitting a program for this challenge, you grant N-Squared Software a worldwide, non-exclusive, royalty-free license to reproduce, publish and distribute your program and associate your name with your program.
    • If you would like your entry to be published anonymously, please notify us when submitting your entry.
  • We reserve the right to extend or discontinue a Promotion at any stage, for any reason.
  • All prizes must be collected in person in Palmerston North.
  • Entry into the challenge is deemed to be acceptance of these rules.

Contacts

The challenge organisers are:

  • Jonathan Couper-Smartt. General Manager, N-Squared Software.
    • Phone: 06 358 1140
    • Email:
  • Jamie Love. Technical Director, N-Squared Software.
    • Phone: 06 358 1140
    • Email:

Resources

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.

Hints

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.

 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki