Two And a Half People

Formula 1K - a JS1K Demo

Formula 1K - a JS1K Demo

JS1K is an excellent new coding competition run by Peter van der Zee, in which the aim is to create a working demo using pure JavaScript, in no more than 1024 bytes. You're given an empty HTML page with a canvas element on it to begin with, and the script you write must work in the latest Chrome, Firefox, Safari and Opera.

My offering was essentially a very basic top-down 'racing game' - and I mean that in the very loosest sense! You can use the up, left and right arrow keys to control the little red car. There aren't any brakes, but the car slows down pretty quickly when you take the power off. There is absolutely no difference between driving on the 'grass' and driving on the 'tarmac', and there's no lap timer, so it's really just a test in self-discipline!

One thing that is pretty good fun, though, is driving the car right out the edge of the screen and seeing if you can turn it around after a while and drive it back onto the screen! I wouldn't say it's immensely exciting, but for 1 kilobyte of minified JavaScript I'm pretty happy with it.

Visit Formula 1K on the JS1K site to take it for a test-drive, or to view the code if you're one of those people. Also be sure to try out as many other demos as possible - some of the submissions are just incredible.