OZONE Asylum
Forums
DHTML/Javascript
20 Liners - August 08 - Space
This page's ID:
30480
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Looks like I'm responsible for this month's theme and after a few days delay (due to excessive climbing of stairs in churches, arcs of triumph and Eiffel towers), here we go. [b]Space! [/b] Use your 20 available lines of code to do something awesome relating to space. Interactive solar systems, procedural exoplanets, space shooters or the good old starfield. It's all good for this month's 20 liner! The rules: Use a maximum of 20 lines of (effective) code Literal object declarations count as one line ( a variable assignment ) except for the body of the methods declared there. Commas shouldn't be used to execute several instructions on the same line. As no one chose to use external libraries for July's, I figure we just let the option to use those stand? So, you are free to use any of the following JavaScript libs: Prototype/Scriptaculous, jQuery, Moo, Processing.js. [code]// WARNING: nonsensical example approaching // declare a couple of variables /* 01 */ var baz = "Fy", /* | */ foo = /* | */ { /* | */ name:"Bob", /* | */ kind:"cat", /* | */ yield:function( msg ) /* . */ // the expressions of this function count /* */ { /* 02 */ var msg = msg||"I'm "+ name +" the "+ kind +"."; /* 03 */ alert( "Meow! "+ msg ); /* */ } /* . */ // resume to line 01 /* | */ isAlive:Math.random()>.5; /* | */ }, /* | */ bar = "it's candy"; /* */ document.body.onclick = function() /* */ { /* 04 */ val= prompt( 'enter a number' ); /* 04 */ for( i=0; i<10; i++ ) /* */ { /* 05 */ alert( stupidFunction( val, i ) ); /* */ } /* */ } // like regular function, anonymous function declaration do not count /* */ (function() /* */ { /* 06 */ setTimeout( arguments.callee, 10 ); /* */ }) /* 07 */ (); // calling it, however counts as an expression /* */ function stupidFunction( a, b ) /* */ { /* 08 */ return a>b?a:b; // I said it was a stupid function /* */ } [/code]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »