Tweetcoding
Last night I was reading my last twitter updates, when something caught my attention. GSkinner come up with a sensational idea of creating a contest using only 140 characters of actionscript, I started to look around and ended up checking the page with the submissions.
There are really great submissions and even know that I can’t beat many of them I decided to try something just for fun, and obviously that I should try a game.
The rules were simple, there was a short “gimme framework” composed of a few characters that basically should allow you to create something nice with more 140 characters of code, inside a enter frame loop. Â See the Gimme code below, the /*src*/ should be replaced by your code in order to compile:
g=graphics;mt=g.moveTo;lt=g.lineTo;ls=g.lineStyle;m=Math;r=m.random;s=m.sin;i=0;o={};function f(e){Â /*src*/}addEventListener(”enterFrame”,f);
With the games in mind I start to create some obscure code and finally sent 2 entries, the first one is the “Catch the square game”, the original ide is that you should move your mouse around the screen trying to catch the square and each time you roll over it you should score some points, but in the end the code had more than the double of characters allowed and I have to give up of many things, in the final version you just try to move the simple lined character over the square, all of this with 140 characters of code. Check the code and the visual result below:
g.clear();if(i)mt(q,j);v=i++%10<1;q=mouseX,j=mouseY;ls(3*r());lt(q,j);g.drawCircle(q,j,10*r());g.drawRect(w=v?500*r():w,h=v?500*r():h,50,50)
The second entry was just a improvement I did on the code in the next morning, I compact more the code, substitute the square for a circle and bring some colors on, check the code and result below:
d=g.drawCircle;g.clear();i?mt(q,j):0;v=i++%15<1;q=mouseX,j=mouseY;ls(3*r(),0xFF*r());lt(q,j);d(q,j,10*r());d(w=v?500*r():w,h=v?500*r():h,50)
I really enjoy the challenge, and in the end the whole code (including the gimme framework)Â have only 173 characters of actionscript, it’s definetively a great result for just this amount of code.
There was a lot of other great pieces of code and you can check more in the official event page.