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 Comment

  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 [...]


Leave a Comment

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