#tweetcoding Part 1

Grant Skinner recently started a little challenge on Twitter to see what could be done in 140 characters of AS3. I took a stab at it too, with this sinewave routine (which looks a bit like Sonic the Hedgehog, or the Drupal logo):

Sinic

var i=0,j=0,s=Math.sin;addEventListener("enterFrame",function(){with(graphics){lineStyle(3);lineTo(99-(x-=s(i+=.003)),99-(y-=s(j+=.005)))}})

…but it became pretty obvious that with ActionScript’s fairly verbose syntax (particularly considering event listeners), there isn’t much room to move. So Grant proposed a template of “gimme code”, which defines a set of shortcuts to commonly used functions, and kicked off the #tweetcoding competition. First prize is a copy of Flash CS4 from Adobe plus a copy of “AdvancED ActionScript 3.0 Animation” by Keith Peters. Second and third runners up will also receive a copy of Keith’s book.

Robert Cadena has set up a page which, aside from tracking the competition entries, also conveniently compiles each entry as well.

As Grant Skinner noted the competition is reminiscent of the old Flash 4 days. It also has parallels with the Demoscene 4k and 64k competitions, and sceners’ abilities to squeeze amazing real-time effects and music into very tight constraints (that’s 30-year-old hardware right there).

So, given my history with the scene, I felt naturally drawn to the comp. There’s something inexplicably cool (yes, and geeky) about getting a computer to perform for you by using a minimal amount of instructions. Realising that you can optimise a routine by tweaking a few instructions or characters here or there gives you a rush that only computer programmers know. When you succeed in shaving off individual characters to just fit within the 140 character limit, it feels good. And if you’ve got characters to spare then that’s just exorbitant, like you’ve left half your food on your plate.

Anyway, I think I’ve geeked-out enough for this post.

Next post – my first three entries.

Leave a Comment