Tetris In 140 Bytes

Is it possible to write a JavaScript program in no more than a tweet‘s length? A website called 140byt.es says it is. The site has an implementation of “almost” Tetris to prove it. Its title is “Binary Tetris“, and it only has two types of block 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 this Tetris In 140 Bytes works. The code includes the main logic to move blocks, detect collision, assign new blocks, remove full lines and render the layout are included (keyboard controls and the final rendering are excluded).

function(a,b,c,d,e){return d+=c,
.replace(/v/,""),d),b=new Date%2?1:3),

140byt.es is a tweet-sized, fork-to-play, community-curated collection of JavaScript that gives you help on figuring out how this kind of tiny JavaScript code can be made. There you will find some interesting tips on how to save space while writing JavaScript.

If your bored how about writing your own 140 character challenge?


  1. MIT Huge Tetris Hack « Tomi Engdahl’s ePanorama blog says:

    [...] Huge Tetris Hack I have earlier written about a tiny Tetris. Not is time for a big Tetris. At MIT, fun is accomplished with architecture. Hackers turn MIT [...]

  2. Tomi Engdahl says:

    Tetris in 446 Bytes

    You want a Tetris that’ll fit inside the master boot record of a disk. You want Tetris as an operating system. You want TetrOS.

    Or maybe you don’t, but it’s a fantastic piece of work, and we love tiny demos

    Tetris that fits into the boot sector.

    TetrOS is a small feature rich Tetris clone which is written in Assembly. It fits completely into a 512 byte boot sector as it requires only 446 bytes (which is the maximum allowed size of the first stage boot loader in the master boot record (MBR) of a drive) and is executed during the boot sequence before any operating system is loaded. Actually, it does not need any existing operating system. TetrOS is an operating system, hence the suffix OS in its name.


Leave a Comment

Your email address will not be published. Required fields are marked *