(Re)Implementing Tetris In the spirit of re-implementing classic video games, I would like to invite the community to create their best implementation of Tetris.


For reference, a screenshot of the official NES version of Tetris.

Required Features


A reasonable scoring system must be in place, which rewards multi-line clears more than single-line clears. The current score must be visible at all times.
The next piece that will appear must be indicated in some manner.
The distribution of the seven tetrominoes should be fairly even (i.e. pseudo-randomly chosen).
The user must have the ability to rotate the current piece in both directions, as well as accelerate its descent.
When the game has ended, it should be clearly indicated that the game is over.
The source code must be structured and easily understandable.


Optional Features


Advancing falling speed after a certain number of clears (i.e. increasing difficulty level), and advancing score per line clear, proportional to speed.
Gravity. You may choose to implement the 'classic' gravity, in which blocks can remain floating over gaps, or you may choose to implement 'flood fill' gravity, in which blocks which have been separated from their original tetromino via line clears may fall into open gaps.
High scores with name input.
Animation after line clears, and/or after obtaining a new high score.


Limitations


Any libraries used (jQuery, PyGame, etc.) should be freely available.
Source code size must not exceed 4096 bytes, excluding whitespace and comments. Any external resources (data files, images, etc.) will be added to the code length, excluding any files which are generated, such as for high scores.
I realize that this is a rather arbitrary restriction; my primary goal is to discourage copy-pasting of existing implementations, and to encourage brevity and self-containment.


Winning Criteria

This challenge will be judged as a popularity contest, meaning that the submission with the most upvotes will be selected as the winner. When upvoting, I encourage users to upvote any and all submissions which they feel adequately meet the above stated requirements.

The winner will be chosen no sooner than 2 weeks after the first valid solution. Additionally, I will be granting a bounty to the winner, roughly proportional to the number of upvotes this question receives (10 * #votes rounded upwards to the nearest 50). Should there be a tie after the 2 week period has expired, the competition period will be extended by one week. Should there still be a tie, I reserve the right to place the final vote.

Please ask for any clarifications. May the best implementation win!
Try: http://tetris.muehe.org

Update There's a global high score. Enjoy beating it or - alternatively - hacking it :-)



CoffeeScript and HTML version, should fulfill the requirements to the best of my knowledge (and I have never really played Tetris). 

$ make stats
4095


Github https://github.com/henrik-muehe/tetris

Features


Exponential scoring
Next piece indicator
Fair randomness
Rotation, move and drop down
Game over indication
Highscore with server backend that should not be that easily fakeable.