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:
- the keyboard interface frequently doesn't work
- the conditions for failure are ambiguous and inconsistent
- the playing field is only 8 blocks wide as compared to the standard 10
- the AI is either overly generous, or stupid, and frequently does NOT provide you with the worst possible piece
(UPDATE: there is also Bastet, which can be played online here, but is also far too forgiving.)
HATETRIS was an experiment to rectify those flaws. Also, every coder has to build Tetris at least once in their life. In addition, I also have a passionate hatred of JavaScript, but I felt that that hatred was borne out of ignorance, so this was an attempt to reconnect with that most derided and crippled of languages. The latter failed, but there you go.
Some things you'll spot:
-
Yes, the game is written entirely in JavaScript. You can find the source code here on GitHub. Very few real games are amenable to this, but Tetris, being played on a very wide grid, is one of them. If you want to save the game locally you'll find a few things that are easy to tweak, including the dimensions of the playing field and the height of the bar.
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.
Update 2010-04-04
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!
2010-04-22
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.
Unfortunately, this version of the game is still far too easy. I can routinely get 3 lines or more in this mode, without any real planning. It is frighteningly straightforward to devise a situation where even looking two moves ahead there is no way for the AI to prevent you from getting at least one line. Forcing more variety in the pieces, even if the piece chosen is always one of the "equal worst", makes the game a lot easier. And finally, looking three moves ahead is computationally impractical to achieve (in client-side JavaScript, at any rate). I think it should be possible to build a game which permits no lines whatsoever, and I hope to create this, and I'm not intending to release any kind of intermediate solution. More as it happens.
2012-06-12
Contrary to what is stated here, HATETRIS is not related to Hatris.
2015-12-06
Replays are now presented in Base65536, making them just about small enough to be shared via Twitter. Old replays will still work, of course.
High scores
Update 2010-04-04
Atypical's 11-point run is "㼬𤆻攌𣺻㼌𤂻𤇃㲬𤄋𤆜𠦻𥄸䂹𣸫𤇁𤦸𤄥𤚤𤂻𤇋𤪄𤆻邌𣊻𤅷𓎻𤆻𤆄𓊺𤆻𤄋㾅𢶻𤅛𤆢𣚻𤆴𓊺𣺻𤄲傣㾹㾸𢪱𢚻綸𢰋𠚻邌𠊹𣽋𤄰炸𤆳𣼰𤇀𣋋𣽛胇𓊸𠪻𥶻𣙻悻ꊬ肬𓎜𤲸𤺸𠤋𥇔傜𥆑𣹌𤋅𣼲做促
".
2010-04-09
An anonymous guest at the Speed Demos Archive achieved 17 points with this run: "𤅫肹𤂻𤄋点𣾻𤇀𤂀𤇀ꊺ𣪻𤆻𤇋𥮔𣺻𤇕𤶸𣾻𤇃𥆹𡒻𤅛𤇗邭𧆹𤶹𡎻𣼛𦥈𣪻𡒜𤄻𢊌𤄻𤆌肜𤶹𡊻𣽫𤇅𤆢傸𤚻𡊻𤄻𤇤𤂎𣹫𤃖𣿇𣻧𤃑𦥈𠪻𡒜𣼻𤧉𢊻𣾅𣋋𣡋𡞻𡊻𢈋𣸻胇醬𡈫𡩫𥪹𠆽𣿣𤹉𤃣郉炌㾬𣺅𤵛悸𤂣𣿁𤋁𡈻脻脛𤪕𣺤ᗊ
".
2010-04-11
Same person got 20 lines later in the thread: "𤅫肺𣾻𤄋𤶸𤂻𤇃𠪻𤆻偈𣺻𣽛𢨋𠚢𣺻𤅋𤶸𤂻𤄛𤮵𢪻𣪻邼𣹋𤅋炬𤒻𤆍𤾴𤁋𤅋𤃫𤇆傝綺𤇣綸𤷉𡒻𤄻𢊜𤄻邜𥆺𤪺𤊻𤅴𤆂傹𡊻𣼋𤇃𦾸𤑋膻𣹫𣹛𥇇傭𡒴𣼻𤹉𤇣𢊬𣉻𤀻𤇅𤋋𣹋𤀫𣼛𤃇𤃀怜𦪹𧆺𤲄邹𥪖𤎴𠨛炎𢊤炎𢊼𣠻ꋇ𤆂候傜㾬肜𤪔𤮸𤴫憸𢈛㼨𤯋𠆼眻𤺴ᕉ
".
2010-04-18
Things Of Interest reader Ivenris is reporting 22: "𤇋𤞹𤆻傌𣊻𤄻ꊸ𣾻𤇇冺𤄫炜𢮻𤆻ꊌ𢪻𤆻邌𤆻𤊻𤅋𤆠𡊻𤂻𤇇醻𤅋𤆁𠮻𣾻𤅛㾌𢢻𤆻斄𤆻𤆆𥆸悻纻𤄻傼𤞻𢊻𤄻遜𤦹𡮻𤊻偃膸𤁛𤁋𤇅𣾻𤇄𤆠𤆼𠆜醹𣹋𤄛𣭛䂻𡢻𣦻𤂻𡉫悺綸𤄰傜催嶌𡬋𣻅𣻃𣉛𡉫𣸰𣉋𤅛𣻄𣈋𡉻𤲸冼𢭋㾼𤂂𢨻𣣆肹𣺃𣝛𣾳
".
2010-04-26
The same anonymous guest at the Speed Demos Archive is now claiming an astounding 28: "𤅫𥆹𣾻𤇁𡊻𤄛炜𣺻㿃𢊻𤄻𠆬𢮻𤆻ꊌ𤆻肸邬𤆻𤊻𤅋𠆬𢊻𤅛𤄋𥆸𣊻𤅫𣞻𤊻𤄻𥆆𤇇肹肻𤶺𢊻𤲻𢮻𡊻𤄻𠮄炎𡪻𡒜𤄻𢊬𤄻𤆢傻𡊻𤀋𤇃𤪹𤎻𤅻𤇦𠆬𥚸𤆻炾纺𦧈𤊻炜肻肻𥆺肼邼𠆼𤲸𡢻𣞻𣊻𤈋𤀻𠫕𣺻𣿇𣻕𠙫𥢸趹𤇣𤹉𤇣𢊌𣸻𤇢旈𠲻𥆻催催炌炬𠆌𤂅㿃ꊌ𤂄𤇅肼𤂀𡋋𡉻偫𤊦𠠋為𤲢𣾲𠜻肼𣻆𤓇ᔻ
".
2010-05-04
Slashdot.jp user Deasuke has reached 30: "𤇃𢊻𤄻嶜𤄋𤇁𡊻𤄛𤆬𠲻𤆻𠆜𢮻𤆻ꊌ𢪻𤆻邌𤆻𤊻𤅋𤲥𣾻𤄋𥆸𣊻𤅛ꊌ𤆻𤆱炼綻𤋅𤅴薹𣪻𣊻𣽻𤇆𤚢𣺻赈𤇣綹𤻈𤇣𤾺𤇃悺𢦻𤂻𤅠㢹𣾻𤄛𤆓𤦹𤊻𤄰炜傼𤞻𢊻𣲻𣺻ꉌ邹𡊻𣹫𤅋𤇅𣾻𤇄𓎜𠚻𤊻𢊻𤉛𤅫𤂑𤃃𡉌𤵛𣹛𤁐𢉋𡉻𡡫𤇠𠞗𤇡𡊄𡒌𣼻燉𣼋𦄘炸邹㢸𠞻𠦻𡊻𣈻𡈻𣈛𡈛ꊺ𠆼𤂅𣻆𣫃𤮺𤊻𡉋㽻𣺬𣈛𡈋𤭻𤂲𣈻𤭻𤊼𢈛儛𡈛ᔺ
".
2017-06-06
Twitter user @chromeyhex edges out the previous record with 31: "𤂻愈䲻㰋𣻋㼘𤇀𠞻𤇋傜𣾻𤇋𤆦𠪵𤃄遈肼𡮻𤆻絈𤇄𤆴𥆹𤅛𤆻𤺸𤅋𤄋𥆺𠞻𤆻𥆐𠪻𠪄𤇄𣺁𤄋𡪄郈𢪻𤇄㲸㰈𤄋𤊁𤂻𤄜𡪼𣢻𡊀𣺻丘𤇋𤩘𣾻𥄈𠪻𤃋㰈𤀛蹌𤅋𤄋𡚡𤇋𤀜緊𣥋𤆜𤆁𠲼綹𥅘𣹋䰉𣼋蹊𤽋𤅋𤆌𤆰𡚡䲻𤇂𤆤𡪥𣚻𣢻𠮤𤺸𤅋𤂄𡘜羹𤇆㾸㶹𤀌𢙛𡞐𤆌㶺𥄩𡮴㺻𣣋𤃋𣛋𥆀𤺦ꉊ𣛄𠚀𠚜𤆀职𢊻徻蹈𢫄𣾻𤄌𤛋𡛁𡫋羌𡏋㼈𢢌𢢬𥂐𡫅𣪄𡊤肻𣊐㼸𢪠𢪄䂸𡪄趜𥀩𡙋𢢀𡊀𣺆㼩𤂄𡫇𡪴䲹𥄉𨂀
".
Discussion (143)
2010-04-03 23:54:52 by frymaster:
2010-04-03 23:55:20 by Thrack:
2010-04-04 00:00:51 by qntm:
2010-04-04 01:00:44 by Bauglir:
2010-04-04 01:21:15 by JeremyBowers:
2010-04-04 04:15:42 by Aaron:
2010-04-04 05:40:38 by Kazanir:
2010-04-04 06:03:59 by cory:
2010-04-04 08:04:30 by Atypical:
2010-04-04 14:02:13 by Aegeus:
2010-04-04 14:48:38 by Michael:
2010-04-04 14:52:41 by Michael:
2010-04-04 15:06:58 by qntm:
2010-04-05 00:24:39 by Daedalus:
2010-04-05 01:48:26 by Atypical:
2010-04-05 02:01:34 by Atypical:
2010-04-05 02:21:39 by Atypical:
2010-04-05 02:26:59 by sunburstbasser:
2010-04-05 03:47:24 by Andrew:
2010-04-05 05:32:58 by slowbroTom:
2010-04-05 06:01:10 by Lar:
2010-04-05 06:13:07 by Tom:
2010-04-05 06:35:14 by Atypical:
2010-04-05 06:49:14 by Tom:
2010-04-05 14:12:55 by Adam:
2010-04-07 02:48:22 by Thrack:
2010-04-07 04:46:10 by Michael:
2010-04-07 08:18:39 by Tom:
2010-04-07 13:46:16 by Tom:
2010-04-07 15:31:06 by Val:
2010-04-07 15:31:37 by Val:
2010-04-07 17:08:01 by Thrack:
2010-04-07 17:58:41 by qntm:
2010-04-07 18:16:08 by Atypical:
2010-04-07 19:41:27 by qntm:
2010-04-07 21:39:53 by Atypical:
2010-04-07 21:40:09 by Atypical:
2010-04-08 04:29:10 by Daniel:
2010-04-08 11:57:50 by Thrack:
2010-04-09 06:53:41 by Tom:
2010-04-09 20:13:37 by Atypical:
2010-04-09 20:40:22 by qntm:
2010-04-09 21:42:46 by John:
2010-04-10 00:28:43 by anonymous:
2010-04-10 02:35:21 by Tom:
2010-04-10 04:04:41 by Kazanir:
2010-04-10 17:18:52 by Guest:
2010-04-12 20:01:23 by Atypical:
2010-04-13 14:57:04 by Jiaying:
2010-04-13 23:56:52 by ejl:
2010-04-14 02:48:20 by my:
2010-04-14 05:32:38 by EternalDensity:
2010-04-14 15:33:12 by neil:
2010-04-15 16:05:11 by RetroBLM:
2010-04-16 20:59:46 by Ivenris:
2010-04-18 15:46:32 by neil:
2010-04-20 23:04:54 by Power:
2010-04-22 18:02:45 by ReverseEngineer:
2010-04-22 18:13:31 by T:
2010-04-22 18:47:50 by TheGZeus:
2010-04-23 04:12:53 by neil:
2010-04-23 09:54:26 by me:
2010-04-23 10:49:04 by gumboot:
2010-04-23 22:03:09 by Chuck:
2010-04-24 19:28:16 by Kamineko:
2010-04-24 21:48:53 by qntm:
2010-04-25 01:20:09 by dwineman:
2010-04-25 19:04:13 by digarb:
2010-04-25 19:32:10 by Kamineko:
2010-04-25 20:21:52 by qntm:
2010-04-27 21:39:42 by webmaren:
2010-04-28 11:15:24 by Dimatra:
2010-04-29 03:43:22 by Dimatra:
2010-04-29 15:58:24 by Tom:
2010-04-30 14:57:22 by CS:
2010-04-30 15:16:13 by Yan:
2010-04-30 16:32:34 by Guest:
2010-04-30 22:10:10 by qntm:
2010-05-01 05:56:28 by CS:
2010-05-01 12:31:39 by Guest:
2010-05-03 18:31:03 by sone:
2010-05-03 20:13:13 by qntm:
2010-05-03 20:32:05 by qntm:
2010-05-03 21:23:03 by qntm:
2010-05-03 21:42:13 by hasi:
2010-05-03 22:25:03 by qntm:
2010-05-04 00:36:24 by sone:
2010-05-04 03:20:17 by masuidrive:
2010-05-04 08:52:49 by qntm:
2010-05-04 09:33:55 by masuidrive:
2010-05-04 16:02:47 by SlashdotJP:
2010-05-05 10:50:48 by archmond:
2010-05-05 21:51:13 by T:
2010-05-05 23:54:22 by CS:
2010-05-06 01:48:21 by T:
2010-05-06 09:06:03 by qntm:
2010-05-06 11:52:12 by T:
2010-05-06 20:35:06 by qntm:
2010-05-06 20:59:16 by qntm:
2010-05-07 05:54:00 by T:
2010-05-07 17:19:30 by Luke:
2010-05-07 17:46:44 by qntm:
2010-05-10 12:29:18 by bshnet:
2010-05-10 13:14:44 by qntm:
2010-05-19 02:23:13 by Steve:
2010-05-19 07:08:40 by qntm:
2010-05-31 23:19:48 by Hobbes:
2010-10-12 09:12:52 by bottleHeD:
2010-10-12 09:18:52 by bottleHeD:
2010-10-20 22:26:48 by dtanders:
2010-11-15 23:56:34 by trophymursky:
2011-02-04 09:55:21 by Rick:
2011-02-04 11:06:20 by qntm:
2011-02-07 10:11:55 by Rick:
2011-02-07 16:04:23 by qntm:
2011-02-09 11:06:43 by Rick:
2011-03-29 19:25:44 by HydraBurrito:
2011-03-29 20:25:19 by qntm:
2011-04-20 01:21:32 by FinalOne:
2011-04-20 08:23:43 by qntm:
2011-04-22 03:43:19 by wallawalla:
2012-04-22 09:25:04 by Robert:
2012-04-22 09:31:32 by qntm:
2012-04-22 11:26:50 by Robert:
2012-06-10 16:37:59 by Muzozavr:
2012-06-19 17:41:42 by Muzozavr:
2012-08-14 10:20:15 by Robin:
2012-11-05 14:38:09 by Muzozavr:
2013-01-16 03:57:24 by MK:
2013-12-01 04:58:32 by QuillMcGee:
2014-02-04 05:08:12 by Quelthias:
2014-12-02 17:20:54 by Piotr:
2015-09-18 04:31:04 by Ben Goldberg:
2015-09-18 05:00:31 by Ben Goldberg:
2016-03-07 17:01:25 by vaiyt:
2016-04-26 14:17:11 by saladin_the_great:
2016-06-17 13:26:30 by Dwscdv3:
2016-08-01 06:36:20 by Jared:
2017-02-25 07:11:20 by Piotr Grochowski:
2017-06-06 22:46:30 by @chromeyhex:
2017-06-06 23:20:52 by qntm:
2017-06-07 00:13:20 by qntm:
2017-07-23 13:43:03 by mina: