Hacker News new | past | comments | ask | show | jobs | submit login
Bouncing Beholder: JS1k winner explained (haverbeke.nl)
132 points by sant0sk1 on Sept 25, 2010 | hide | past | web | favorite | 8 comments



At the start of the program there is a for/in loop that goes over the properties of the canvas context, and adds a new property, with a shorter name, for each of them. It took some experimenting to find an abbreviation algorithm that doesn't have clashes on any of the methods we use---I ended up using the first letter of the name plus the the 7th letter, if any. So lineTo becomes l, and quadraticCurveTo becomes qt. I can then use these short names to actually access the methods---without ever having written out the full name.

Clever.


Not a bad choice, methinks. That's an amazingly polished experience for sub-1k. I do wonder if some of the arguably-better submissions were excluded for bugs, though I think I'd do the same in a competition. Readily-apparent bug = disqualified.


The chess entry doesn't support a fundamental game move (castling). I'd consider that a bug but last time someone pointed that out they got blasted on HN.

Anyway, it's a remarkable chess-like game.



I'm struggling to understand how the hell this is done. Is the whole thing generated in code (as in the imagery/graphics) or are they external elements that are loaded into the application and manipulated in the code?


everything is generated in code. this is what makes it so hard


I can't help but say that I think that there were more deserving demos, in terms of how impressive/fun they were compared to the winner, though I'm glad to see the chess one up there. Not to knock the winner though, it's also a good demo and probably won because of better cross-browser compatibility or something.


Did you read the explanation? I thought the context method abbreviations was brilliant.

The chess one got second place. I like it too, but it was not really a "playable" game, more a demo of some cool hacks.

I DID however find it interesting that none of the top three were the visualization demos which seemed to make up a majority of the entries.




Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: