JS1k: The JavaScript code golfing competition

2013 - Spring!

Home   Rules   Demos   Submit Mailing list  |  Update demo meta data  |  The /r/js1k subreddit JS1k, the yearly JS code golfing competition

Competition rules 2013

  1. All submissions must not be bigger than 1k

    1k means 1024 bytes. Note that we're not counting in characters. JavaScript uses 16bit unicode values internally. The server will enforce this restriction and reject your submission if you try anyways.
  2. No externals

    That means no linking, no including and so no using of any external resources. You are free to submit your 5 minute intro video or coffeescript interpreter in your submission though, as long as the server permits you to. And no, you may not use another submission in your submission. Your submissions should be able to be put in a single script tag (see the shim) and should work offline from the start.
  3. Deadline is Sunday, March 31st 2013

    The submissions automatically close at midnight my time (CET, which is UTC+1)
  4. Only one submission will compete per person

    But you are free to submit as many demo's or updates as you want (but try not to make me mad please, I manually check and ok these submissions). Judges can submit but their entries will not compete (they're aware :). The jury will only consider your LAST submitted entry! And you obviously can't submit an entry after the deadline passes.
  5. Anything goes for golfing

    Do not worry about Crockford's wrath. Your submission does not need to pass jslint, style guides or anything like that. You may compress your submission in any way you can, as long as the result still runs in the browser. It MUST run in the browser, in the provided shim. That (and the other rules on this page) is pretty much the only restriction.
  6. Your demo must work in three browsers

    The target browsers are Firefox, Chrome, and Opera. Your demo must run in any of them, without a problem. Speed is not my concern (but might be of the judges). Internet Explorer and Safari are not included because they require a spefic OS (windows/osx). Specific versions:

    • Firefox 18
    • Chrome 24
    • Opera 12.13

    But really, your demo should just work in all browsers. Standardization has come a long way. When push comes to shove the jury can apply browser versions for a verdict. These rules are in place to prevent dirty browser specific hacks. I hope that the result will be a more "pure and generic" js demo. Not just something that works because one browser implemented something nifty (like sharp variables in Firefox).
  7. Your demo must work in the provided shim

    And in case it matters, the demo must work when the shim is put in the frameset all demos are running in. The entire submission will be put in the provided shim. All demo's do this so we're all on the same level. The shim provides three variables. The shim is very simple and provides a canvas element. The a variable contains a reference to the context (canvas.getContext('2d')) of this canvas. Var b contains a reference to document.body and c contains a reference to the canvas tag.
  8. Your demo should just work

    • Must not crash in any of these browsers (no syntax or DOM errors)
    • Should behave approximately equal in all browsers
    • Platform shouldn't really matter (especially since it should work in all browsers)
    • Speed is not my concern, but might impact a jury verdict
  9. Other things you should know

    • Your demo does not need to be visually appealing (certainly not to be submitted and listed on the site!), but it tends to help... it must do something though, even if it just outputs to console
    • Your entire submission will be put in the script tag in the provided shim (the above rules assume this)
    • Your script may not mess with the frameset, break out of its frame, read/write anything that's not in its own frame, force a reload of the page or redirect the user to another site
    • Your script may not "phone home". That includes saving high scores etc. The exception is a button/link to tweet, if you have room left for it
    • Do not submit HTML soup. It will be rejected. Your entire submission should work inside script tags (don't be smart, you cannot use </script>...<script> either)
    • Test your minified script result in the (entire!) shim. There's a reason we provide it. Paste your script in the proper position before you do. The a, b and c variables are fixed, so make sure tools like Closure don't change their name.
    • Audio and video are in. WebGL is out. Be careful about codecs and target browsers...
    • The theme Spring is only a suggestion, it's not a requirement
  10. I have a final say in things

    I think I'm reasonable enough but I reserve the right to reject anything. This hasn't happened before and I don't think it will this time, so don't worry :)
  11. Tips & Tricks

    • document.body will be available when your code executes!
    • document.body.children is available
    • When minifying, beware that the boiler plate variables must remain the same! Make sure you test your submission in the same before actually submitting
    • Firefox does NOT support exposing element id's as globals. Please don't assume this again and again.