This is bad Tetris. It's hateful Tetris. It's Tetris according to the evil AI from "I Have No Mouth And I Must Scream".
I have to be honest, this is not an entirely original idea. However, RRRR's implementation of the concept of a game of Tetris which always gives you the worst possible pieces leaves much to be desired:
Some things you'll spot:
You can also put custom pieces in the list at the top, including pieces of more or fewer than 4 "bits" (components). Note that at the moment these pieces are sorted so that the least convenient ones are at the top. All things being equal, with no other major differences between possibilities, the AI will give you an S.
No, there is no gravity: on the one hand I simply never got around to implementing it and on the other hand I honestly think that gravity is the least of your problems with this particular Tetris clone.
The method by which the AI selects the worst possible piece is extremely simple to describe (test all possible locations of all possible pieces, see which of the pieces' best-case scenarios is the worst, then spawn that worst piece), but quite time-consuming to execute, so please forgive me if your browser chugs a little after locking each piece. If you can figure out a way to accelerate the algorithm without diminishing its hate-filled efficiency, do let me know. The algorithm for "weighing" possibilities is to simply maximise the highest point of the "tower" after the piece is landed.
More complex algorithms could be possible, but aren't strictly necessary. Also, now that replays have been added, I can't change the algorithm without screwing up or invalidating all the replays.
Yes, you will get a lot of S pieces. But it doesn't give you solely S pieces - if that were the case, then it would be possible to make lines forever, which is much too easy.
If you can't figure out how to turn a constant stream of S pieces to your advantage, that's your problem. Rest assured that once you do, other pieces will appear. If you get creative, it is possible to force all 7 different pieces to appear, including even those incredibly useful T pieces.
There is no randomness in the process - the AI is deterministic, so you are all playing the same game. It may be possible to create a strategy to get into a loop and continuously outplay the AI. If so, let me know. If not, my top score is 5 lines.
I've added some replay functionality. This will allow you to share particularly high-scoring games with other people just by passing a simple string of hexadecimal around, instead of having to laboriously capture video!
A small update regarding the possibility of HATETRIS II (i.e. the one where the algorithm looks more than 1 piece into the future). I successfully implemented this recursive search, which can theoretically look to unlimited depth. I also added a huge number of optimisations - such as treating the well as a list of binary numbers rather than an array - in order to make it so that new pieces were generated in 0.5 seconds under these conditions, rather than closer to 30 seconds without those optimisations. I also added functionality to add more variety to the pieces.
Replays are now presented in Base65536, making them just about small enough to be shared via Twitter. Old replays will still work, of course.
Replays are now presented in Base2048. Thanks to a combination of this and the new increased character limit on Twitter, even the latest high score replay of 31 lines will now fit in a Tweet, which it previously did not. Old hex and Base65536 replays will continue to work.
Atypical's 11-point run is "
An anonymous guest at the Speed Demos Archive achieved 17 points with this run: "
Same person got 20 lines later in the thread: "
Things Of Interest reader Ivenris is reporting 22: "
The same anonymous guest at the Speed Demos Archive is now claiming an astounding 28: "
Slashdot.jp user Deasuke has reached 30: "
Twitter user @chromeyhex edges out the previous record with 31: "