jQuery Tetris

Posted on by

jQuery Tetris

Following in the footsteps of the excellent Yahoo! UI Tetris by Dustin Diaz comes jQuery Tetris.

This Javascript implementation of Tetris, written by Franck Marcia, comes in at only about 5.8kb, compared to Dustin’s 30kb for YUI Tetris. This is a great example of the short code that’s possible using jQuery, while still making something that’s quite cool.

5 thoughts on “jQuery Tetris

  1. No contest whatsoever. Not to mention my version was made from a challenge that happened in about 2.5 days… and it works in all major browsers (this one doesn’t work in Safari), and this version doesn’t even get everything right. Tetris needs to have line stats per block and it needs to allow me to rotate both left and right.

    If I wanted, I could probably make an exact replica of this version with YUI using even less code ;) – But I think my points were made the first time round.

    C’mon John, I love ya, but I thought you’d see through this one.

  2. Ha, Dustin, don’t worry about it – last night I got caught up ‘comparing’ both versions (aka: playing each for hours on end). It’s obvious that you put a lot of effort into yours, with nice graphics, correct piece movements, etc. Franck admitted that this was just a fun hack in his original mailing list post, and was just in good fun.

    In the end, however, a game like Tetris isn’t really the best showcase for any Javascript library, as you’re doing so many matrix manipulations as to make it rather worthless. Things like a tabbed ui or drag-and-drop interaction would be a more worthwhile venture (at least for jQuery and YUI).

  3. There’s the John I love and know :) Indeed, Tetris is not a good showcase, but remember, let’s not turn this into a battle. I think the best promotion for jQuery is things like the 15days deal. That will most definitely get people looking by showing them what they can do with it.

    I think these days a lot of developers just want to see if certain things are possible. Lest we forget the copy/pasters out there that just find something they like and don’t care what library it’s based from. Eventually they’ll dig into that library over time because it did that cool thing that they originally downloaded it for :) – or at least that’s what I think. I could be way off too. :p

  4. Dustin,

    Yes, you were the first and *you* give me this cool idea. As John said, I just wanted to have fun (coding and testing ;-)… and found a way to promote jQuery as I could.

    No contest here, just code, fun and sharing!

    btw, I did it in two nights and an afternoon

  5. Franck, good work my friend :)
    I think Tetris can be used as a good exercise for any developer to flex their brain for a bit. If I were a computer science professor, I would have my students make tetris as an assignment :D