Post Archive
› September 13, 2004
JavaScript Quine Contest - Summary
The JavaScript Quine Contest started 2004-08-31 has now ended. The entries are listed on a separate page at JavaScript Quine Contest - Entries. The winning entries for the respective categories are as follows:
- First Submitted Quine
- Patrick H. Lauke, 193 characters
- Smallest Quine
- David Lindquist, 47 characters
- Most Elegant Quine
- David Lindquist, 67 characters
- The motivation as follows: A single expression statement, no nested quotes, uses only one assignment and two function calls. Beautiful, slim and contains only the absolute necessities.
- Fastest Quine
- Not really relevant category, so I dropped it.
Comments
1. September 13, 2004 02:08 PM
2. September 13, 2004 02:58 PM
patrick h. lauke Posted…
grant, i'm sure he will...but if you're impatient, you can check the "first submitted" winner here: javascript quine
3. September 13, 2004 04:20 PM
liorean Posted…
All valid entries, including the winners. I'll also list who won what category, though I'm having problems with the Fastest Quine category - it seemed like a far better idea when I wrote it than when I read it through the second time. Sure, I can performance test them, but how about browser speed differences? Is the category really relevant at all? I should, as mentioned before, have added a Most Obfuscated Quine category instead. That sounds like more fun.
4. September 13, 2004 05:51 PM
Dylan Posted…
I was also curious about the 'fastest' category... JavaScripts timing abilities always seemed a little coarse. Perhaps dropping that category makes sense.. and opening a second round for the most obfuscated?
5. September 13, 2004 07:59 PM
patrick h. lauke Posted…
looking at the other entries, i'm now hitting myself over the head about using a wrapper function...well, it's probably because of the (blood, sweat and tears) way of reaching that point, but still...that it didn't become obvious to me that i could just simplify that final step...heh.
great stuff, and congratulations to all the boffins who took part. i'll be dissecting the code to learn some more javascript in he coming days :)
6. September 13, 2004 09:07 PM
liorean Posted…
Don't berate yourself for using a rather elegant and nice solution just because it's big. You managed to create a quine that uses only native globels, assignments, string concatenations and a single function call, rather neat actually. Of course it could have been cut a little in size, but still it's not a bad solution.
7. September 16, 2004 08:21 AM
Mathieu 'P01' HENRI Posted…
Indeed the most elegant quine is quite elegant
That's great to see how others handled the challenge. I was stuck in a 2 statements method and didn't found how to nest the template in the factory nor how to use an eval() statement without falling in an infinite evaluation booby trap.
8. September 16, 2004 09:13 AM
liorean Posted…
Poi: Yeah, it is. It isn't the smallest size it could be, though, it could be cut down to 59 characters:
unescape(q='unescape(q=%270%27).replace(0,q)').replace(0,q)There were a few other strong candidates to the elegancy nomination, though. Your 57 characters quine was of course one of them. Patrick's one was perhaps an even stronger candidate though, and would probably have won if he had seen that the entire function body could be made global, shortening it to the following 107 characters quine:
q='\'',s='\\',a='"q="+q+s+q+q+",s="+q+s+s+q+",a="+q+a+q+","+a',"q="+q+s+q+q+",s="+q+s+s+q+",a="+q+a+q+","+a
Patrick's quine has the elegancy of only using operators, not a single call to a function that is not declared in the quine itself.
Grant Palin Posted…
Will you be posting the code for the winning entries as well? I'd be interested in seeing what it looks like!