Slashdot Mirror


Tetris In 140 Bytes

mikejuk writes "Is it possible to write a JavaScript program in no more than a tweet's length? A website called 140byt.es says it is and has an implementation of Tetris to prove it. Ok, it only has two types of block — hence its title "Binary Tetris" — and there's no rotate, but it works. The blocks fall down the screen and you steer them into place. You can try it out by playing the demo. Of course the real fun is in figuring out how it works and there is lots of help on the site — so if you're bored how about the 140 character challenge?"

6 of 215 comments (clear)

  1. Nostalgia ... by WrongSizeGlass · · Score: 5, Insightful

    It reminds me of the old days when code was efficient and had to fit onto small discs and into limited RAM and/or ROM. The original Mac ROMs were 128k, and all the apps had to run in 128k of RAM. It was amazing what could be done when it just had to fit.

    1. Re:Nostalgia ... by Anonymous Coward · · Score: 5, Insightful

      Oh, well, in that case, allow me to introduce you to my 4 character Tetris program.

      t();

      (That's a function call to an external library that does all the other shit needed)

  2. Not 140 bytes by sakdoctor · · Score: 3, Insightful

    The function requires an animation loop and event handler otherwise it does nothing. After that, it's way more than 140 bytes.

    1. Re:Not 140 bytes by Gavin+Scott · · Score: 4, Insightful

      Yes, it's about 816 characters in total. This is complete fail compared to the kind of stuff that's done for the IOCCC competition. The 140 byte function they wrote implements once tiny part of the whole thing, and looking at it suggests that there really aren't going to be many interesting programs possible in 140 bytes of javascript.

      If you want to see actually impressive tiny programs written in 2K of C code, like the guy who wrote an entire BASIC interpreter one year and then followed it up with a compiler for the same language the next year, then check out the IOCCC sinners page:

      http://www.ioccc.org/years.html

      G.

  3. More! by slasho81 · · Score: 3, Insightful

    Now, this is proper Slashdot material. More of this, please!

  4. Re:Dear /. Overlords by kelemvor4 · · Score: 4, Insightful

    Your being to picky. People care less about grammar these days ten most other things. Irregardless, there doing the best they can

    Was that as painful for you to write as it was for me to read?