View Full Version : Guidelines and Other Info
kirupa
January 11th, 2006, 03:56 PM
25 Line AS Contest
In this contest, create something cool in Flash using only 25 lines of ActionScript code. The deadline for submitting your entry is February 1st.
What is a Line of Code?
A line of code is a statement. Function declarations will not count towards your line count. For example, the following is 6 lines of code:
foo = new function() {
var red:Node = new Node();
var blue:Node = new Node();
var red:Node = new Node();
blue.addEdge(red, "blue->red");
blue.addEdge(green, "blue->green");
green.addEdge(red, "green->red");
}
You can only have one statement per line. You will not be allowed to piggyback statements into one huge line. You will also not be allowed to draw anything or import anything to your library. Everything must be drawn using AS only.
In Flash, for the most part, statements are ended by a semicolon, so you have an idea of what a statement is or isn't based on that. Even though loops and if statements don't end in semicolons, they will count towards your final line count.
Regarding abbreviated if statements (condition ? ifTrue : ifFalse), you may use them only if you are not daisy-chaining commands together. In other words, you cannot have something like:
true ? (trace(123), trace("asd"), trace(Boolean(1)), trace(321), trace("dsa"), trace(Boolean(1)), trace(98765), trace("qwerty"), trace(String(!1))) : null;
But you can have something like:
true ? _root.arrayList.reverse() : _root.arrayList.pop()
You will not be allowed to use import statements to import any external classes or data sources.
How to Submit Entry?
Simply create a new thread in the 25 Line AS Contest (http://www.kirupa.com/forum/forumdisplay.php?f=133) forum with your entry's name as the subject. Ensure you have attached your SWF using the forum's attach feature. If you don't, you may risk the chance of some unforeseen server error causing your entry to not work for the judges.
After you have submitted your entry, check the stickied "Current Entries" thread after a day or so to ensure that I have your entry and name listed.
You are allowed to submit as many entries as you want. Just ensure that you create a new thread for each of your entry. It makes it easier for me to find and add your entry when it is a new thread as opposed to being buried as a post.
So What are the Prizes? :P
The prizes are:
1st place - $50 Amazon.com gift certificate
2nd place - $30 Amazon.com gift certificate
3rd place - $20 Amazon.com gift certificate
Judging/Judges
Entries will be judged based on creativity. While that is a broad topic with each judge possibly having their own interpretation of what makes something creative, it should at least provide some indication of what you should focus on while coding your entry.
The judges have not been determined, but you will see more information on that as the contest deadline nears.
-----------------------------------------------------
If you have any questions, post them in this thread and I will respond to them as quickly as possible. I will edit this post to incorporate good questions and related answers.
Good luck!
- kirupa.com Moderators
Krilnon
January 11th, 2006, 05:47 PM
Which version of Actionscript/Flash should entrants code in? Not everyone will have Flash 8 or MX 2004, and some will have the alpha version of Flex with ActionScript 3. Also, in Flash MX and below, there wasn't any case sensitivity, so would code containing something like 'loadvars' be acceptable instead of 'LoadVars'? (I believe there were plenty of people who had issues with that before)
kirupa
January 11th, 2006, 06:38 PM
Which version of Actionscript/Flash should entrants code in? Not everyone will have Flash 8 or MX 2004, and some will have the alpha version of Flex with ActionScript 3. Also, in Flash MX and below, there wasn't any case sensitivity, so would code containing something like 'loadvars' be acceptable instead of 'LoadVars'? (I believe there were plenty of people who had issues with that before)
As long as there are 25 lines of code and an SWF, I don't think it matters which version of Flash you write your code in.
:beam:
TheCanadian
January 11th, 2006, 06:40 PM
Whoa this sounds cool, I'll have to get to work :kommie:.
Counting the code seems sort of hazy to me. How will you factor external classes into this? Will things such as the Tween or filter classes not be allowed? And if they are, would 3rd party classes like TweenExtended be accepted?
kirupa
January 11th, 2006, 06:59 PM
You can use built-in classes, but you can't use 3rd party classes. If any classes come pre-installed with Flash, you can do whatever you want with them :)
TheCanadian
January 11th, 2006, 07:08 PM
Won't that give Flash 8 uses an advantage over Flash <7 users?
bigmtnskier
January 11th, 2006, 07:13 PM
Won't that give Flash 8 uses an advantage over Flash <7 users?
I totally agree. :(
What about MTASC users :P We don't need an fla do we?
Jeff Wheeler
January 11th, 2006, 07:19 PM
Sound awesome. I might be willing to judge again. :)
jerez_z
January 11th, 2006, 07:27 PM
awesome can't wait to enter
kirupa
January 11th, 2006, 07:38 PM
In that case, would saying something like "You may not use any external classes. In other words, no import statements." make it more fair?
In Flash 8, can you still use the Tween class without actually importing the *.as file? If you cannot, then I can replace the current policy on external classes with the above.
freeskier89
January 11th, 2006, 07:38 PM
Yes, I think that Flash 8 users will have an advantage and I prefer to have it be even, but hey, if you want to keep it the way it is, that is fine. A month ago, I was thinking of how absolutely awesome having a pure AS contest would be. Thank you a lot Kirupa! =)
Oh but anyway, on to the questions.
You can only have one statement per line. You will not be allowed to piggyback statements into one huge line. I am really bad about that (or good, depends on how you look at it ;)). I am curious to how strict that will be. Like for example, could you please tell me forms of this example code would be tolerable. Here is a quick progression of "piggybacking" I think there is a happy medium, I just would like to know where you think that is!
//form 1
string1 = “Hello fellow kirupians”;
if(a==b){
mc = _root.createEmptyMovieClip(“mc1”,1);
variable = parseInt(“101000101”,2);
thirdword = string1.split(“ ”);
thirdword = string1[2];
thirdword = thirdword.substring(0,thirdword.length-2);
mc.variable = variable.toString()+ thirdword;
}
//form 2
string1= “Hello fellow kirupians”;
if(a==b){
mc = _root.createEmptyMovieClip(“mc1”,1)
variable = parseInt(“101000101”,2).toString()
thirdword = string1.split(“ ”)[2];
thirdword = thirdword.substring(0,thirdword.length-2);
mc.variable = variable.toString()+ thirdword;
}
//form 3
string1= “Hello fellow kirupians”;
if(a==b){
mc = _root.createEmptyMovieClip(“mc1”,1);
mc.variable = parseInt(“101000101”,2).toString()+string1.split(“ ”)[2].substring(0,thirdword.length-2);
}
//form 4
string1= “Hello fellow kirupians”;
if(a==b){
mc = _root.createEmptyMovieClip(“mc1”,1);
mc.variable = parseInt(“101000101”,2).toString()+string1.split(“ ”)[2].substring(0,thirdword.length-2);
}
//form 5
if(a==b){mc = _root.createEmptyMovieClip(“mc1”,1);mc.variable = parseInt(“101000101”,2).toString()+“Hello fellow kirupians”.split(“ ”)[2].substring(0,thirdword.length-2);
}
As I said before, Thanks for holding this competition. It sound sweet :P
Edit: argh... How do I get that awful formatting in the code to go away. I pasted from word and notepad :(.
-freeskier89 :)
kirupa
January 11th, 2006, 07:46 PM
Some piggybacking, such as what you did, is fine.
Depending on the answer to Post 10, I may not allow any importing of external files :)
kdd
January 11th, 2006, 08:17 PM
@kirupa - since i won't be participating, if you want help, i would be willing to do something... :)
freeskier89
January 11th, 2006, 08:31 PM
Oh, one more question. Will you accept multiple entries or just one?
TheCanadian
January 11th, 2006, 08:37 PM
In that case, would saying something like "You may not use any external classes. In other words, no import statements." make it more fair?
In Flash 8, can you still use the Tween class without actually importing the *.as file? If you cannot, then I can replace the current policy on external classes with the above.
You can use the fully qualified path to reference classes, as in:
new mx.transitions.Tween
Edit: My apologies, I misunderstood - the Tween class requires import/qualified class path so I agree with your statement :sailor:
I think it would be fair to only use the classes at the global path, but you would have to see if the users of the lower versions are actually concerned about this.
Thanks :azn:
Chaoswarp
January 11th, 2006, 08:47 PM
1. One entry per Contestant?
2. Can we call external code, PHP or other server side logic?
3. Can we pass GET variables into the SWF?
3a. If so can we assume they will always be there?
4. Only attach the SWF? Do you need the FLA also, or a copy of the code?
hehe Sorry for nit-picking, just wanna make sure I got my facts straight before i put my mind to work :)
Sounds fun, I am exicted!
kirupa
January 11th, 2006, 10:38 PM
1. One entry per Contestant?
2. Can we call external code, PHP or other server side logic?
3. Can we pass GET variables into the SWF?
3a. If so can we assume they will always be there?
4. Only attach the SWF? Do you need the FLA also, or a copy of the code?
hehe Sorry for nit-picking, just wanna make sure I got my facts straight before i put my mind to work :)
Sounds fun, I am exicted!
Hi Chaos!
1. You can submit as many entries as you want.
2. No, unfortunately calling external PHP/text/XML/etc. data isn't allowed.
3. No, no variables should be passed into Flash. Everything you need should be within those 25 lines of code.
4. Oops - I forgot to mention that. Good question :P I will need either a copy of the code or the FLA.
Cheers!
Kirupa :angel:
Deril
January 12th, 2006, 01:15 AM
this should be interesting..
but first... one must think out "something cool".. :)
recursion.. and bitmap(Flash8) class could be the key...
I will try to think out something..
some hints...
use:
var1 = var2 = var3 = .. = 10;
var1++;
var1--;
var1 = (var2 < 0) ? st1: st2;
var1 = 2;
if ((var1 *= 3) == 6) {
..
}
false == 0
true == eny Number not 0 :)
if posible.. :)
there is more leagal tricks..
and with assignment tricks... you can put lot of stuff to one line...
a *= (f -= (b += 2)+(c = d*f))*34;
...
good luck.
PS:
You will not be allowed to piggyback statements into one huge line.
not sure that ''piggyback'' means..
like this? :
var1 = blahblah;var2 = superblahblah;var3 = blahblahasinvar1andvar2butdoubled;
Smee
January 12th, 2006, 03:45 AM
There needs to be some rule about the "(expression) ? true : false" thing, you could put a whole bunch of stuff on one line if you use that :pa:
McGiver
January 12th, 2006, 04:45 AM
does something like
_root.createEmptyMovieClip(blabla)._x=10
count as 1 or 2 lines
J
January 12th, 2006, 04:59 AM
so.......
It means we need to use _root.createEmptyMovieClip().
Basically its drawing dynamically through actionscript.:ponder:
And 25 lines means 25 lines of codes and does not include :
function drawing() {
}
Creating API using methods like lineStyle() , lineTo()
curveTo(), moveTo() ...
Am I right?:stare:
bigmtnskier
January 12th, 2006, 09:58 AM
so.......
It means we need to use _root.createEmptyMovieClip().
Basically its drawing dynamically through actionscript.:ponder:
And 25 lines means 25 lines of codes and does not include :
function drawing() {
}
Creating API using methods like lineStyle() , lineTo()
curveTo(), moveTo() ...
Am I right?:stare: Sounds right. And actually 25 lines gives you more leeway than you would expect. :)
Pattt
January 12th, 2006, 10:36 AM
Can I have objects such as movieclips and other on the stage?
Edit: how many things can I submit?
Deril
January 12th, 2006, 11:00 AM
sure you can...
if you invent a way place it there without having them in the lybrary...
or loading them from outside...
You will also not be allowed to draw anything or import anything to your library.
:beam:
creat it with AS...
HINTs:
ActionScript 2.0 Language Reference>ActionScript classes > MovieClip
check out all drowing methods... you can do a lot with plain code alone...
also best class ever.. - bitmapData.. its a revolutional class to flash and you can do miracles with it..
next .flash 8 filters... you can do some more miracles with them too...
dont foget texts...
actualy ... there is not much that canot be done with AS alone.... but compresing it to 25 lines... thats the magic.. :)
I am starting to enjoy it...
I have 3 ideas... 2 of them >50 lines.. well at least on the paper it is... :(
Low Lines
January 12th, 2006, 11:05 AM
I have a question, how many lines would this be counted as?
myArray = [[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]],
[[0,0,0,0,0,0,0,0,0,0]];
Can this be on just one line, because the AutoFormat button sticks it on one line...
And is there a limit for anything like this?
Deril
January 12th, 2006, 11:23 AM
Low Lines,
its 1 statement..
just put it to 1 line befor sending ...
Low Lines
January 12th, 2006, 11:41 AM
Low Lines,
its 1 statement..
just put it to 1 line befor sending ...
I made a small mistake, it's actually,
myArray = [[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0],
[0,0,0,0,0]];
But I take it is still 1 statement then?? And can I make it as long as I want or is there going to be a limiter for this contest?
mpelland
January 12th, 2006, 12:10 PM
lowlines... lol, thats the way i made my site (www.marcpelland.com).. nice long arrays. this contest looks interesting.
I would suggest making something that is 25 lines (in your opinion), post it and if it breaks the rules you can fix it and then resubmit it? because I am also a little confused about piggybacking.
As for flash 8 v. flash 7, why not only allow access to classes that are available in flash 7 ?
kdd
January 12th, 2006, 12:47 PM
this means that kirupa and judges will have to manually go through each entry and find out how many lines it contains. :cantlook:
mpelland
January 12th, 2006, 12:50 PM
wouldn't they have to do that anyways? to make sure that it fits into the guidelines?
Low Lines
January 12th, 2006, 12:58 PM
this means that kirupa and judges will have to manually go through each entry and find out how many lines it contains. :cantlook:
So I take it that long arrays are legal then. I thought it could be a way to draw my movieClips, tilemode format. And if 1 array only allocates to 1 line, then I could have multiple images and create my own animation or something.
But this does sound a little much for someone to manually go through...
mpelland,
Is all that drawing stuff on your site done through actionscript or was it drawn as separate frames or something?
Deril
January 12th, 2006, 01:14 PM
and I gues line containing more then 1024 chars considered as 1 line too...
it dosent fit to AS window... (1024 max..)
I have few programs with lines more then that..
hm.. it gives me some thoughts.... I can write my own translation engine....
lets say all my commands will be placed into arrays.. then.. little loop... which loops the array.. than translaites it... divides target from buildin functions..... but wait hm... I will have some problems with logic and loopings..
whatever.. it still can be used in some cases...
sounds more like cheating then swift coding to me.... :/ I gues I will drop the idea.. (partialy..)
virusescu
January 12th, 2006, 01:26 PM
This contest is fun. The hardest part is to actually create something interesing with only 25 lines of code. I don't understand the ones that are concerned more about how to cheat and get more statements into a single line and a more "compact" code. The "25 lines of code" should really reflect the size of the code. If you hardcode 1 mega of variables into one big array on the first line and the pretend how good of a programmer you are and how magic the effect you produced is, who are you fooling?
Deril
January 12th, 2006, 01:35 PM
you mised the point.. :)
bah.. whatever.
Low Lines
January 12th, 2006, 01:38 PM
I wasn't planning on entering anyway...
Krilnon
January 12th, 2006, 01:51 PM
As long as there are 25 lines of code and an SWF, I don't think it matters which version of Flash you write your code in.
:beam:
That certainly makes it sound like using ActionScript 3 would be acceptable. Are you sure that you want to allow that?
virusescu
January 12th, 2006, 02:01 PM
I wasn't talking about you Daril. I was talking in general ;).
If somebody happens to find a way to bend the rules or interpret them in such a manner that gives him a certain advantage, it doens't really means this is a moral thing to do.
Anyway. The problem is creating something with as less code as possible. The "25 lines" is just a measurement. Sure you can bend it and make a really long line of code, but I think people should see a challenge in actually solving this problem than finding a way to interpret the rules. But that's just me, and I've said this before, and I don't want to highjack the thread SO
I'll keep an eye on this and hope for as many entries as possible.
Good luck to you all
NiñoScript
January 12th, 2006, 04:05 PM
this._x = _xmouse, this._y = _ymouse;
that is counted as 1 or 2 lines?
in a for statement
for(init, bla bla){
trace("im cool");
}
that counts as 3 lines? or just 1???? :puzzle:
kdd
January 12th, 2006, 06:41 PM
hey NinoScript, i don't know about the first one, but the second one, i think, would be counted as two lines. one for the "for" and one more for "trace" :)
freeskier89
January 12th, 2006, 06:52 PM
Ninoscript, I am almost positive that it would be 2 lines for your first one, because you are setting two variables.
I really think that for the linecount you should just code how you normally do, just don't try to smash everything into one array or something similar.
Can I have objects such as movieclips and other on the stage?
if you invent a way place it there without having them in the lybrary...
or loading them from outside... I am pretty sure that you are not allowed to load things from the outside. As far as I know, Kirupa wants people to use the drawing API/BitmapData class.
icio
January 12th, 2006, 08:14 PM
I think the key here is the "auto-format" button.
Exclude lines of just "}" and comments and that's roughly your line-count.
I might see what I can come up with. Great idea, k.
@Krilnon - You're not allowed to import, so I doubt AS3 would be an option.
@Kirupa - Could you keep an up-to-date rules list in the top post?
bigmtnskier
January 12th, 2006, 08:17 PM
In that case, would saying something like "You may not use any external classes. In other words, no import statements." make it more fair? Please... =)
It is an extremly unfair advantage for us MX'ers. :)
McGiver
January 12th, 2006, 08:51 PM
does
_root.onMouseMove = function() {
count as a line?
virusescu
January 12th, 2006, 09:00 PM
from what I understood it doesn't;
icio
January 12th, 2006, 10:08 PM
so.......
It means we need to use _root.createEmptyMovieClip().
Basically its drawing dynamically through actionscript.:ponder:
And 25 lines means 25 lines of codes and does not include :
function drawing() {
}
Creating API using methods like lineStyle() , lineTo()
curveTo(), moveTo() ...
Am I right?:stare:
Could somebody confirm that `lineStyle`, `lineTo`, etc... don't add to the line-count?
Smee
January 12th, 2006, 10:13 PM
So, defining ANY variable will count as one line? For example, is this three lines?
Ob = {one: 1, two: 2, three: 3};
Sinister Shadow
January 12th, 2006, 10:55 PM
This sounds really interesting but the rules need to be more clearly defined. No idea what I could throw into this though... Hmmm...
Oh, and I'm assuming we post our code with out entries.
kirupa
January 12th, 2006, 11:15 PM
Smee - that is one line. Variable declarations can be done anyway you want. Also, you can use abbreviated conditional statements :)
Sinister - yep!
bigmtnskier
January 12th, 2006, 11:26 PM
So are imports allowed? Please say "no"... *begs*
:)
kirupa
January 12th, 2006, 11:30 PM
No, imports will not be allowed :) I just edited the guidelines in the first post to reflect that.
E-Slayer
January 12th, 2006, 11:32 PM
So, ultimately, you're permitted 25 semicolons?
bigmtnskier
January 13th, 2006, 12:06 AM
No, imports will not be allowed :) I just edited the guidelines in the first post to reflect that.
Thanks Kirupa :hugegrin:
NiñoScript
January 13th, 2006, 01:31 AM
soo.... condition ? ifTrue : ifFalse are allowed, right??
kirupa
January 13th, 2006, 01:33 AM
soo.... condition ? ifTrue : ifFalse are allowed, right??
Yes: http://www.kirupa.com/forum/showpost.php?p=1752275&postcount=48
But, if it is used to piggyback or combine a long list of statements into them, then now. If you are simply trying to cut down on an if/else statement from three lines to 1, then that's fine. But if the ?/:/if method is used to daisy-chain statements, then no.
:block:
dbarbarian
January 13th, 2006, 01:34 AM
Hey there Kirupa. This is a very interesting competition.
Some things I would like to know:
Would for loops be treated the same as if statements?
And just to state ico's question again, do lineTo and curveTo etc. count toward the line count?
kirupa
January 13th, 2006, 01:41 AM
Hi dbarb,
1. lineTo and curveTo do count toward the line count.
2. For for loops, could you be a bit more specific? Also, I just made a modification to what I mentioned above for the abbreviated if function.
dbarbarian
January 13th, 2006, 01:49 AM
On the for loops, i was thinking something like this:
Is:
for(j=0; j<6; j++) {
trace(a);
}
two lines or one line:
for(j=0; j<6; j++) {trace(a);
}
thanks =)
kdd
January 13th, 2006, 02:31 AM
that is two lines. one for "for" and one for "trace" otherwise, it's cheating. :P
kirupa
January 13th, 2006, 03:12 AM
Yep - two lines C:-)
Sinister Shadow
January 13th, 2006, 03:16 AM
I'm pretty sure this is piggy backing but I just want to confirm ;)
private function pback(target:MovieClip, method:String, paramObj:Object):MovieClip
{
var methodArray:Object = {lineStyle:["width", "color", "alpha"], moveTo:["x", "y"], lineTo:["x", "y"], curveTo:["cx", "cy", "ax", "ay"]};
target[method](paramObj[methodArray[method][0]], paramObj[methodArray[method][1]], paramObj[methodArray[method][2]], paramObj[methodArray[method][3]]);
return target;
}
var circle:MovieClip = createEmptyMovieClip("circle", getNextHighestDepth());
pback(circle, "moveTo", {x:10, y:0})._parent.pback(circle, "lineStyle", {width:1, color:0x000000, alpha:100})._parent.pback(circle, "curveTo", {cx:30, cy:10, ax:10, ay:20})._parent.pback(circle, "curveTo", {cx:-10, cy:10, ax:10, ay:0});
:lol:
That's the first time I've done something like that and I'm pretty proud of myself!
icio
January 13th, 2006, 07:10 AM
LOL. Nice one, Sinister.
I think even the function name gives it away :D
theflash
January 13th, 2006, 11:19 AM
private function pback(target:MovieClip, method:String, paramObj:Object):MovieClip
{
var methodArray:Object = {lineStyle:["width", "color", "alpha"], moveTo:["x", "y"], lineTo:["x", "y"], curveTo:["cx", "cy", "ax", "ay"]};
return target[method](paramObj[methodArray[method][0]], paramObj[methodArray[method][1]], paramObj[methodArray[method][2]], paramObj[methodArray[method][3]]);
}
var circle:MovieClip = createEmptyMovieClip("circle", getNextHighestDepth());
pback(circle, "moveTo", {x:10, y:0})._parent.pback(circle, "lineStyle", {width:1, color:0x000000, alpha:100})._parent.pback(circle, "curveTo", {cx:30, cy:10, ax:10, ay:20})._parent.pback(circle, "curveTo", {cx:-10, cy:10, ax:10, ay:0});
I modified the return statement from sinister shadow... I wanted to confirm for that.
Yes definately we need clearance for some of the methods because each line counts and we plan accordinly... so we need to know what code is what count
kirupa
January 13th, 2006, 01:02 PM
You can combine the return with the target :)
Also, sinister's method of having the lineTo/lineStyle/moveTo data being stored in an array is acceptable....and clever :hugegrin:
dbarbarian
January 13th, 2006, 07:58 PM
Does an fscommand count toward your line count?
I have fscommand("allowScale",false); in order to keep the swf from enlarging and thus slowing down when viewed as an attachment.
EDIT: Nvm mind. It seems like the attachment scales the swf file anyways even though the code is there.
EDIT 2:
Just read through freeskier's (sp?) post. I completely forgot about Stage.scaleMode. Does that count toward the line count?
kirupa
January 13th, 2006, 09:24 PM
Yeah, that would increment the line count :evil2:
dbarbarian
January 14th, 2006, 03:20 AM
lol. I see how it is...
In that case, can we link to all our swf files and not upload them to the kirupa server?
virusescu
January 14th, 2006, 05:28 AM
Regarding abbreviated if statements (condition ? ifTrue : ifFalse), you may use them only if you are not daisy-chaining commands together. In other words, you cannot have something like:
true ? (trace(123), trace("asd"), trace(Boolean(1)), trace(321), trace("dsa"), trace(Boolean(1)), trace(98765), trace("qwerty"), trace(String(!1))) : null;
But you can have something like:
true ? _root.arrayList.reverse() : _root.arrayList.pop()
I have a problem about this rule. Seems like people understood that the folowing statement counts as a single line
(this.startDie != true) ? ((this["t_"+Math.floor(this.snake.x/10)+"_"+Math.floor(this.snake.y/10)].state == undefined) ? (this["t_"+Math.floor(this.snake.x/10)+"_"+Math.floor(this.snake.y/10)].state = "s"):( (this["t_"+Math.floor(this.snake.x/10)+"_"+Math.floor(this.snake.y/10)].state == "f") ? (this["t_"+Math.floor(this.snake.x/10)+"_"+Math.floor(this.snake.y/10)].state = "s",this.snake.leng+=1,this["t_"+Math.floor(this.snake.x/10)+"_"+Math.floor(this.snake.y/10)].block.removeMovieClip(),this.createBlock(random(4 0)*10+5,random(40)*10+5,"00FF00","f",this.d++)):0)):0;
This is an example from barbarian's snake game, but he's not the only one doing this. For crying out loud this are a lot of if else statements. Maybe it looks like a clever thing to do as it is hard to achieve and follow.
The rules are just weird. You allow something like this and you count as a line the Stage.scaleMode declaration that people would want to use if they have processor intensive effects.
Sinister Shadow
January 14th, 2006, 05:33 AM
You can combine the return with the target :)
Also, sinister's method of having the lineTo/lineStyle/moveTo data being stored in an array is acceptable....and clever :hugegrin:
:stunned:
Really? Cool! :hugegrin:
Oh, thanks for the edit theflash
Joppe
January 14th, 2006, 07:52 AM
Now im just a huge noob and got a really huge noob question :lol:
var f = _root.createEmptyMovieClip(the_draw, _root.getNextHighestDepth);
That is one line , right?
virusescu
January 14th, 2006, 07:58 AM
Notice that getNextHighestDepth is a method ;)... and That's one line alright, but it's not right... :D
Sinister Shadow
January 14th, 2006, 07:59 AM
Yep!
dbarbarian
January 14th, 2006, 12:43 PM
virusescu: sorry about that. I reread the rules. Ill remove my entries.
virusescu
January 14th, 2006, 01:46 PM
wait barbarian. I don't wanted to sound like that. I don't care if you use this kind of tricks. I just wanted to clear the rules out. Maybe the rules will change and state that this is allowed :). Kirupa should decide
TheCanadian
January 14th, 2006, 01:49 PM
Very sorry if this has been asked already, but could this:
var obj:Object = new Object({prop0:"prop0", prop1:"prop1", prop2:"prop2", prop3:"prop3", func0:function () {
trace("func0");
}, func1:function () {
trace("func1");
}, func2:function () {
trace("func2");
}, func3:function () {
trace("func3");
}});
be used to replace this:
var prop0 = "prop0";
var prop1 = "prop1";
var prop2 = "prop2";
var prop3 = "prop3";
function func0() {
trace("func0");
}
function func1() {
trace("func1");
}
function func2() {
trace("func2");
}
function func3() {
trace("func3");
}
Thanks :be:
dbarbarian
January 14th, 2006, 02:38 PM
virusescu: No worries. You're right though. I violated the rules, so I removed the entry. I'm not bitter or anything. In fact, I'm happy you pointed it out. :)
If the rules change, I'll just upload the entry again.
kirupa
January 14th, 2006, 02:56 PM
TheCanadian - sure. Several entries feature similar techniques in assigning properties to movie clip objects :)
NiñoScript
January 14th, 2006, 10:42 PM
var obj:Object = new Object({prop0:"prop0", prop1:"prop1", prop2:"prop2", prop3:"prop3", func0:function () {
trace("func0");
}, func1:function () {
trace("func1");
}, func2:function () {
trace("func2");
}, func3:function () {
trace("func3");
}});how many lines would that be??
kirupa
January 14th, 2006, 11:03 PM
5 - 1 for the variable declaration and 4 for the trace commands. The rest are function declarations.
Smily
January 15th, 2006, 12:16 PM
Wouldn't it be better and less confusing if you would limit the swf in size (for example 1, 2 or 3kb. Then just dissallow loading anything (xml, swfs, images) externally but allowing to import just the classes that are shipped with Flash (in 8 the filters and if not, building in 9 would be really hard and would require to specify the full path for everything).
That would naturally eliminate all cheating (as 10 short lines would be as long as 1 really long line, well maybe newlines would add a few bytes or so :D)
? :h: ?
Tell me if I'm making any sense :)
icio
January 15th, 2006, 04:04 PM
No, part of the skill can be in compressing lots of code into as few lines as possible.
squan
January 15th, 2006, 06:24 PM
Hmmm, well ...
been working on it for an hour or 2 ...
and I find it pretty hard to simulate Half Life 2 with 25 lines ...
but I won't give up just yet! :snug:
icio
January 15th, 2006, 06:26 PM
Pfft... newb!
;) :lol:
bombsledder
January 15th, 2006, 06:58 PM
im confused...
does doing something like this take up lines
this._x=43,this._y=4;
is something like this one or 2 lines?
really hoping its 1 otherwise im screwed with my new project o.O
kirupa
January 15th, 2006, 07:01 PM
that would be two lines :)
bombsledder
January 15th, 2006, 09:11 PM
lol there pretty much goes my first post and the one i havent posted yet >.>
think its impossible to do breakout with under 25 lines
F+zzyDice
January 16th, 2006, 12:58 AM
This type of contest has been done tons of times before, do a google search. Also how are you going to make sure other people wont steal from all the past contests?
dbarbarian
January 16th, 2006, 02:58 AM
bombsledder: Does that mean I can give breakout a shot? :pa:
dbarbarian
January 16th, 2006, 01:37 PM
Is this line allowed:
(i<13) ? this.create(((((i+2)%3)==0) ? 3 : 1.5),i,0,i-1,70,((((i+2)%3)==0) ? "0x33FF33" : "0xFFFFFF")):null;
And if it is, how many lines would it account for?
I'm not sure about the conditionals within the function call this.create(...).
Thanks. =)
shmageki
January 16th, 2006, 05:22 PM
Wouldn't it be better and less confusing if you would limit the swf in size (for example 1, 2 or 3kb. Then just dissallow loading anything (xml, swfs, images) externally but allowing to import just the classes that are shipped with Flash (in 8 the filters and if not, building in 9 would be really hard and would require to specify the full path for everything).
That would naturally eliminate all cheating Sounds smart to me. Although "2kb AS Contest" doesn't sound as cool as "25 Line AS Contest". Oh and also I think that .swf size depends on what version you're using because of the changes to the compiler in each release.
What's the ruling on the Microphone and Camera objects? Allowed or not?
Jeff Wheeler
January 16th, 2006, 05:25 PM
I think it should be a character limit instead :thumb:
(I haven't used that smiley in forever.)
garyzero
January 16th, 2006, 05:26 PM
Can I judge?
kirupa
January 16th, 2006, 06:08 PM
Can I judge?
Sure - I think the current judges list is seb, nokrev, kdd, and you. If I forgot anyone, drop me a PM :)
F+zzyDice - many of us have seen those previous entries, and I think a few here may have participated in some of them also! It's tough to know for sure, but I trust the people who submit entries.
dbarb - You can use that as one line, for even though you have a lot of conditionals, they don't piggyback and combine statements.
shmageki - Sure, you can use cameras and microphones.
Sinister Shadow
January 16th, 2006, 06:59 PM
Sure - I think the current judges list is seb, nokrev, kdd, and you. If I forgot anyone, drop me a PM :)
Seb's judging? That means as long as I use CS2 I'll get far ;)
Oh... wait... :trout:
icio
January 16th, 2006, 08:53 PM
:lol:, sinister
I have a question - when's the final date for entries?
kdd
January 16th, 2006, 09:05 PM
Sure - I think the current judges list is seb, nokrev, kdd, and you.
yay... when did i become one? well, thanks anyways...
edit: icio - the first post by kirupa says feb 1st.
F+zzyDice
January 16th, 2006, 09:19 PM
the next contest should be using flash lite 1.1 for a mobile phone. Now that would be hard. ;)
Jeff Wheeler
January 16th, 2006, 09:48 PM
I'm a judge? Ok. When does the contest end, and when do you need my picks. How many?
kirupa
January 16th, 2006, 11:13 PM
Oh - I didn't mean to put you on the spot nokrev. I must have gotten you confused with somebody else :pa:
kdd - I thought that is what you meant with this post: http://www.kirupa.com/forum/showpost.php?p=1751269&postcount=13
Regarding any details about the judging, I haven't thought those through just yet. There is still plenty of time, and I won't know the number of entries, etc. until I get a good idea of how many entries there would be in total :)
NiñoScript
January 16th, 2006, 11:43 PM
there are goin to be thousands of them :P, they just keep coming and coming :lol:
btw.. is this piggybacking?
actions = {x:lineStyle(2), x:lineTo(200,100), x:lineTo(100, 200), x:trace("qwerty")}
i think it is... but just to be sure...
edit: and in the thing im making now, i have a long line like this:
arrayOfObjects = [{obj:1}, {obj:2}, {obj:3}, {obj:4}, {obj:5}, {obj:6}, "etc........"];
//this is just an example, it doesnt even look like mine, and its not even half of mine
that's ok right? this is not piggybacking i think
another edit: WOW! 444 posts! :lol:
kdd
January 17th, 2006, 12:08 AM
actually, i did mean that. :shifty: thanks again...:lol:
i thought you hadn't noticed that post, but ok, you have...
ElectricGrandpa
January 17th, 2006, 04:20 AM
I think it should be a character limit instead
Nah, that'd just be a pain, because then you'd have to rename all your variables to one-letter names and junk like that.
ElectricGrandpa
January 17th, 2006, 04:32 AM
I know it's a tad late, but I'd also like to argue towards *allowing* built-in classes to be imported. As far as I know, the only reason they're not core classes in the first place is to save memory or file size. It's not like you'd be saying "this is a Flash 8 only contest" or anything, it just means that if you've got Flash 8, you can use it.
I know MX 2004 is still pretty common, but if we're going to limit it to that, we might as well limit it to Flash 4 or something. It just seems almost behind-the-times to not allow people to use a program that's been out for over 3 months.
Besides, it takes a bunch of extra lines to import those new classes, so that already puts those who use Filters or BitmapData at a few lines disadvantage(which is huge when you've only got 25 lines).
I think it'd be perfectly fair to include, because it's not like you hinder the MX 2004 developers in any way, and you'd also probably get some really cool/innovative entries from it.
kirupa
January 17th, 2006, 09:42 AM
According to an earlier post by someone, there is a way to use those built-in classes without using an import statement. I think you tag the path of your class to the beginning of your data object, but I don't know for sure.
If you want to use that method, then that's fine.
:sailor:
ElectricGrandpa
January 17th, 2006, 10:58 AM
Cool, I'll look into it... yeah I'm not trying to be a pain or anything, but I kinda missed the boat when we were first creating the rules so I figured I'd throw my two-cents in :)
McGiver
January 17th, 2006, 03:12 PM
I hope ElectricGrandpa doesn't mind if I ask about that chain statements:
are they legal?
kirupa could prohibit evaluating functions, that would probably limit it.
Because else it is an extremely good way to compact Code, you can do anything within one line then.
nathan99
January 18th, 2006, 01:47 AM
How many times can someone win, like can they get 1st,2nd,and 3rd... if u can seems a bit... unfair
kirupa
January 18th, 2006, 02:18 AM
Somebody can (and in the past has ;)) won several spots in a contest. I haven't decided yet, but I'll ask around and see what others think would be better.
TheCanadian
January 18th, 2006, 03:26 AM
If somebody is good enough to get multiple places then I think they deserve it :rambo:
I think the answer to this will be no but are we allowed to import fonts into the library for dynamic embedding?
Sinister Shadow
January 18th, 2006, 07:19 AM
Somebody can (and in the past has ;)) won several spots in a contest. I haven't decided yet, but I'll ask around and see what others think would be better.
*cough*soundslikerhubarb*cough*
Jeff Wheeler
January 18th, 2006, 07:01 PM
No, I'm fine with judging. That's cool. I'm in. :)
kirupa
January 18th, 2006, 07:07 PM
I think the answer to this will be no but are we allowed to import fonts into the library for dynamic embedding?
Yep, you cannot import font files into the library :)
ElectricGrandpa
January 18th, 2006, 07:08 PM
I hope ElectricGrandpa doesn't mind if I ask about that chain statements:
are they legal?
kirupa could prohibit evaluating functions, that would probably limit it.
Because else it is an extremely good way to compact Code, you can do anything within one line then.
Well, if you look at dbarbarian's latest breakout game, you can see that even with chains, you still run out of lines, and he's got em packed pretty tight... not to mentioning that programming like that is the equivalent of banging your head on a rather painful piece of cheese.
thelbane
January 19th, 2006, 03:31 AM
I think it should be a character limit instead :thumb:
I completely agree. Simple. Done.
A friend pointed this competition out to me and, at first, I was giddy with anticipation. Sadly, after wading through eight pages (so far) of rules and fairly inconsistent guidance, that feeling is all but gone.
The inability to leverage "PHP/text/XML/etc." seems somewhat anti-Web 2.0. (Don't roll your eyes. I'm serious!) While this contest appears to be focused on building a 25-line island of functionality, the world is clammoring for decentralization and community-driven applications. Vast amounts of data don't translate to vast functionality if that's the concern -- as long as that data is not executable code or can be parsed into executable code. Maybe a better rule could have been "Scripting of any kind cannot be parsed from an external data source" in order to help ensure that all the code is in that 25-line frame.
So, essentially I can't build that XML-fed 25-line CMS I had envisioned. Fine.
Well, lets look at the other rules... So many opinions! (And here's one more!) While compression routines are encouraged in other byte-limited programming competitions, it's nearly considered cheating here. Or at least some parlor trick only those showy types would use, but not anything a self-respecting Flash developer would use. Bah! Tight code and the use of as many "tricks" as possible demonstrates programming acumen and that's what this competition is about, right? Plus, it's difficult to judge "how much compression trickery is too much" since we all have our own little ways of economizing our code.
Like other competitions, set a character or byte limit (as suggested at least twice previously) and don't be afraid of what people will build! By keeping the rules simple, the playing field will be level and nobody has to worry about whether or not they're inadvertantly "cheating" by "stacking commands." By keeping the rules simple, you also make judging infinitely easier. The judges can spend less time validating entries and more time determining their "niftiness quotient."
Sorry to be such a killjoy in my first post. I promise I'll be good from here on out.
-Lee
paragmetha
January 19th, 2006, 07:26 AM
Hi!!!
If i use some inbulit class which returns obj as follows
this.createEmptyMovieclip("a",5).createEmptyMovieclip("b",4)
is aboue code line or statement will be consider as a 1 statement or 2 statements.
thanks
25 Line AS Contest
In this contest, create something cool in Flash using only 25 lines of ActionScript code. The deadline for submitting your entry is February 1st.
What is a Line of Code?
A line of code is a statement. Function declarations will not count towards your line count. For example, the following is 6 lines of code:
ActionScript Code:
</p>
<p>foo = new function() {</p>
<p> var red:Node = new Node();</p>
<p> var blue:Node = new Node();</p>
<p> var red:Node = new Node();</p>
<p> blue.addEdge(red, "blue->red");</p>
<p> blue.addEdge(green, "blue->green");</p>
<p> green.addEdge(red, "green->red");</p>
<p>}
You can only have one statement per line. You will not be allowed to piggyback statements into one huge line. You will also not be allowed to draw anything or import anything to your library. Everything must be drawn using AS only.
In Flash, for the most part, statements are ended by a semicolon, so you have an idea of what a statement is or isn't based on that. Even though loops and if statements don't end in semicolons, they will count towards your final line count.
Regarding abbreviated if statements (condition ? ifTrue : ifFalse), you may use them only if you are not daisy-chaining commands together. In other words, you cannot have something like:
ActionScript Code:
true ? (trace(123), trace("asd"), trace(Boolean(1)), trace(321), trace("dsa"), trace(Boolean(1)), trace(98765), trace("qwerty"), trace(String(!1))) : null;
But you can have something like:
ActionScript Code:
true ? _root.arrayList.reverse() : _root.arrayList.pop()
You will not be allowed to use import statements to import any external classes or data sources.
How to Submit Entry?
Simply create a new thread in the 25 Line AS Contest (http://www.kirupa.com/forum/forumdisplay.php?f=133) forum with your entry's name as the subject. Ensure you have attached your SWF using the forum's attach feature. If you don't, you may risk the chance of some unforeseen server error causing your entry to not work for the judges.
After you have submitted your entry, check the stickied "Current Entries" thread after a day or so to ensure that I have your entry and name listed.
You are allowed to submit as many entries as you want. Just ensure that you create a new thread for each of your entry. It makes it easier for me to find and add your entry when it is a new thread as opposed to being buried as a post.
So What are the Prizes? :P
The prizes are:
1st place - $50 Amazon.com gift certificate
2nd place - $30 Amazon.com gift certificate
3rd place - $20 Amazon.com gift certificate
Judging/Judges
Entries will be judged based on creativity. While that is a broad topic with each judge possibly having their own interpretation of what makes something creative, it should at least provide some indication of what you should focus on while coding your entry.
The judges have not been determined, but you will see more information on that as the contest deadline nears.
-----------------------------------------------------
If you have any questions, post them in this thread and I will respond to them as quickly as possible. I will edit this post to incorporate good questions and related answers.
Good luck!
- kirupa.com Moderators
treatkor
January 19th, 2006, 07:57 AM
i like that the restrictive yet open to interpretation rules of this contest have lead to a discussion of code compression/optimization and a sharing of techniques in the source of the entries. even if the rules are different from most "small" code contests.
thanks to this contest, i learned a couple of neat array tricks , was introduced to bitwise shift operators, and i also never knew you could do this: for(a=o,b=0;a<20;a++,b++) i never knew you could put more than one iterator in a for statement. this contest is so cool.
So, essentially I can't build that XML-fed 25-line CMS I had envisioned. Fine.
sure you can ;) just post it in the Source/Experiments Forum. nice first post :)
▄▄▄
January 19th, 2006, 02:00 PM
If somebody is good enough to get multiple places then I think they deserve it :rambo:
I think the answer to this will be no but are we allowed to import fonts into the library for dynamic embedding?
no no no no no... if you thnk like that, the bill gates is not doing anything wrong. And he dosent monopolize anything.
PD: i'm not english, sorry my writing lol
kirupa
January 19th, 2006, 03:05 PM
parag - sure.
thel - maybe the future version of this contest might have a character limit instead. Also, I glance through the entries and the lines of code before having them be added to the Current Entries list. Judges won't have to do the line counting at all :pleased:
nathan - good entries help determine who takes the top spots. If a few good entries were created by the same designer, then more power to him/her. The judges don't pick the winners - they only narrow it down to about 10 or 15 entries. All of you will vote from the 10 or 15 entries for the Top 3 spots.
Smily
January 22nd, 2006, 07:59 PM
So it IS allowed to use flash 8 features without import statements, like so:
something = flash.filters.BlurFilter()
? I'm just looking for confirmation and I know kirupa said it's ok a few posts back, but it was rather like "btw" thing. I want the rules on the front page to be more clear on this subject. Thanks :D
kirupa
January 23rd, 2006, 03:16 PM
So it IS allowed to use flash 8 features without import statements, like so:
something = flash.filters.BlurFilter()
? I'm just looking for confirmation and I know kirupa said it's ok a few posts back, but it was rather like "btw" thing. I want the rules on the front page to be more clear on this subject. Thanks :D
Smily - yep, you can do that :)
ElectricGrandpa
January 23rd, 2006, 03:29 PM
Character limit = BAD.
All of the code written for this competition so far is READABLE. If we were to have a character limit, it wouldn't be. All of the variables would have silly 1 character names. Just not a good idea for what we've got. I think the current rules are perfect, actually.
Smily
January 27th, 2006, 04:03 PM
I'm still not following, is this.createEmptyMovieClip(...).createEmptyMovieCli p(...) allowed then?
edit: or in general, this.method().anotherMethod().yetAnotherMethod()
like this.createEmptyMovieClip(...).attachBitmap(...)
?
kirupa
January 27th, 2006, 04:45 PM
Smily - no you cannot do that, for that would be considered piggybacking.
(-:
Smily
January 27th, 2006, 04:50 PM
What about
if (variable++ > variable2)
? :)
(sorry for asking so much, i just want to make sure what i can and can't do :))
freeskier89
January 27th, 2006, 04:51 PM
How is this legal then, kirupa? I am just trying to draw the line between piggybacking and legitimate coding. :D
this.pA(this.o1,"lineStyle",{w:2,c:0xFFFFFF,a:100})[this].pA(this.o1,"lineTo",{x:390,y:0})[this].pA(this.o1,"lineTo",{x:390,y:345})[this].pA(this.o1,"lineTo",{x:0,y:345})[this].pA(this.o1,"lineTo",{x:0,y:0});
this.pA(this.o2,"beginFill",{c:0xFFFFFF,a:100})[this].pA(this.o2,"lineStyle",{w:5,c:0xFFFFFF,a:50})[this].pA(this.o2,"moveTo",{x:-30,y:-4.5})[this].pA(this.o2,"lineTo",{x:30,y:-4.5})[this].pA(this.o2,"lineTo",{x:30,y:4.5})[this].pA(this.o2,"lineTo",{x:-30,y:4.5})[this].pA(this.o2,"lineTo",{x:-30,y:-4.5})[this].pA(this.o2,"_x",{x:195})[this].pA(this.o2,"_y",{y:320});
this.pA(this.o3,"lineStyle",{w:10,c:0xFFFFFF,a:100})[this].pA(this.o3,"lineTo",{x:.2,y:0})[this].pA(this.o3,"_x",{x:195})[this].pA(this.o3,"_y",{y:(this.o2._y-4.5-5)})[this].pA(this.o3,"s",{s:0})[this].pA(this.o3,"ang",{a:-15*Math.PI/36})[this].pA(this.o3,"h2",{h:5})[this].pA(this.o3,"w2",{w:5})[this].pA(this.o3,"sub",{s:0});
virusescu
January 27th, 2006, 04:53 PM
@freeskier89: where did you got that from :bandit: ?
Smily
January 27th, 2006, 04:54 PM
That seems far from legal if mine is illegal :D
freeskier89
January 27th, 2006, 04:56 PM
Dbarbarians breakout game :hugegrin:
Truly I think that is some really nice coding he has there :D. I just dont see how it is different than what kirupa said not to do.
Sinister Shadow
January 27th, 2006, 05:18 PM
Hey, they're all haters! I created the original (http://www.kirupa.com/forum/showthread.php?t=205183&p=1752402)! :krazy:
I guess it's borderline, just like using the fully qualified path for accessing a class (e.g. flash.filters.GlowFilter). It is effectively a function that calls another function depending on the parameter's passed to it and functions weren't declared illegal so I'm in favour of using them.
Besides, do you have any idea how much of a pain it is to code using that style? I tried a slightly different approach in FlashType (http://www.kirupa.com/forum/showthread.php?t=205811) and it still takes absolutely AGES!
freeskier89
January 27th, 2006, 05:35 PM
Haha... I know how much of a pain it is, and I envy you for being able to pull yourself through it :D. I'm really indifferent on whether or not they should be allowed, but I just do not have any clue how it is different than "Piggy backing". Heck you did call it pback didnt you ;) Kirupa has said multiple times its alright though.
Smily
January 27th, 2006, 06:47 PM
Comon K-man, clear things up for me/us :)
so...
this.method().anotherMethod().yetAnotherMethod()
is not allowed and
this.pA(this.o2,"beginFill",{c:0xFFFFFF,a:100})[this].pA(this.o2,"lineStyle",{w:5,c:0xFFFFFF,a:50})[this].pA(this.o2,"moveTo",{x:-30,y:-4.5})[this].pA(this.o2,"lineTo",{x:30,y:-4.5})[this].pA(this.o2,"lineTo",{x:30,y:4.5})[this].pA(this.o2,"lineTo",{x:-30,y:4.5})[this].pA(this.o2,"lineTo",{x:-30,y:-4.5})[this].pA(this.o2,"_x",{x:195})[this].pA(this.o2,"_y",{y:320});
is allowed?
...
Sinister Shadow
January 28th, 2006, 12:07 PM
Heck you did call it pback didnt you ;) Kirupa has said multiple times its alright though.
;P
kirupa
January 28th, 2006, 01:47 PM
Smily, in that case it's fine. I thought you wanted to blatantly string together many createEmptyMovieClip instances together similar to how some users tried to have all of the lineStyle/moveTo/etc. combined into one line without using an array or the more creative method used by dbarb, sinister, and other.
:nat:
Sinister Shadow
January 28th, 2006, 05:50 PM
:kommie:
Someone really needs to create a :worship: or :bow: smily!
Ben H
January 30th, 2006, 04:14 PM
2 days left :D Nearly time --w00t!!!--
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.