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. 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.
High scores
Update 2010-04-04
Atypical's 11-point run is "032A AAAA AAAA 8C00 AAAA AA8C AAAA AAAA AB00 AAAA AB22 AAAA AABA AAAA AAA8 0002 EAAA A8C0 AAAA B0AA AAAA B000 16AA AAA7 2AAA AAAA EAAA AAA7 6AAA AAAA AD6A AAAA AAD5 556A AAAA AA95 56AA AAAA AA6A AAAA AA55 6AAA AAAA 8AAA AAA9 4AAA AAAA 9556 AAAA AAA0 2AAA AAAA AA8A A6AA AAAA A556 AAAA AA00 02AA AAA0 00AA AAA2 AAAA 2AAA 82A6 AAAA A2AA 62AA A56A AAA2 D6AA AA95 76AA AA80 0AAA AAA8 02AA A802 AAA8 00AA ACAA AAEA AAD6 AAAA B556 AAAA 556A AAA6 AAAB D555 6AAA 8AAA A02A AAD5 AAAB 6AAB 555A AB56 AAE2 AA00 F7AA AC2A A83A A7AA B5AA C000 AAA5 A82A B000 A8".
2010-04-09
An anonymous guest at the Speed Demos Archive achieved 17 points with this run: "56AA AAAA AA9A AAAA AAAA 8AAA AAAA AA00 AAAA AAAA ACAA AA8A AAB2 AAAA AAA5 6AAA AAAA 9AAA AAAA AEAA AAAA 9F5A AAAA ABD6 AAAA AAD5 6AAA AAAB 00AA AAAA AEAA AAAA FD6A AAAA BD56 AAAA AF5A AAAA FEAA AAB5 5AAA ABC2 AAAA 9BF0 0AAA AAA6 BBF0 0AAA AAAB AC02 AAAA AAEA AAAB 6AAA AB55 AAAA B56A AAAB 5AAA AA80 AAAA AA82 AAAA AB2A AAAC 02AA AAAB F6AA AAFE AAA5 6AAA AF56 AAAD 56AA BF55 AABC 2AAA 6FC0 2AAA A6BB F00A AAAA EB00 AAAA AE5A AAEA AADA AAA0 2AAA A82A AAAC AAAC 02AA AAD5 5AAA B5C0 AAB5 6AA9 AAAF 6ABD 56AB F00A AA6B BF00 AAAB A5AA B00A AAB2 AA5A A96A B55A A80A AA80 2AAA C2AA B0AA C02A AC02 A9C2 A9E9 76A6 AAEA".
2010-04-11
Same person got 20 lines later in the thread: "56AA AAAA AAA6 AAAA AAAA 8AAA AAAA AB55 AAAA AAAB 00AA AAAA AA9A AAAA AAA6 0AAA AAAA A96A AAA8 AAA9 A808 AAAA AA9A AAAA AAAB 55AA AAAA A82A AAAA AA97 5AAA AA9A AAAA A6AB 5AA6 AAAA 6AAA AAAA C02A AAAA AABF BEAA AAA9 E9AA AAA9 AAAA AAFE AAAA AD5A AAAA F0AA AAA9 BF00 AAAA AA9B AD56 AAAA FC02 AAAA AABA C02A AAAA AB5A AAAA BAAA AAB6 AAAA AB55 6AAA A02A AAAA A82A AAAA ACAA AAAC 02AA AAAA FE9A AAAF EAAA 9D5A AAA9 6AAA AD57 AAAB C2AA A9BF 00AA AAA6 BBF0 0AAA AABA D56A AAC0 2AAA AAD6 AAAB AAAA DAAA A80A AAAA 82AA AAB5 5AAA B2AA A0C0 AAAA AFDA AABF AA9D 5AAA 5AAA 57DA A6AB C2AA 6FC0 2AAA 6BBF 00AA AAEB 00AA AA03 5556 AA02 AAA8 282A AB0A AAB2 AAB6 AA9D AAB5 02AB 55AA 80C2 AAB0 22AB AAD6 AB55 AA00 AA40 AA79 A".
2010-04-18
Things Of Interest reader Ivenris is reporting 22: "EAAA AAAA AB0A AAAA AAAB 0AAA AAAA B00A AAAA AAA9 5AAA AAAA AAD5 6AAA AAAA 0C0A AAAA AAC0 2AAA AAAA 5AAA AAAA AB56 AAAA AAA6 AAAA AAAA D6AA AAAA AAAA AAAA AB6A AAAA AA2A AAAA AAAE AAAA AAAD 56AA AAAA A976 AAAA AA0A AAAA AAA9 6AAA AAA9 6AAA AAAC AAAA AAA8 0AAA AAAA A900 2AAA AAAA A56A AAAA AEAA AAA8 0AAA AAA6 802A AAAA AAB0 AAAA AAC2 AAAA B00A AAAA A5D6 AAAA B00A AAAA 5AAA AAAD 000A AAA9 D6AA AAA6 AAAA AD6A AAAA AAAA AB6A AAAA 2AAA AABA AAAA D56A AAA9 76AA AA0A AAAA A5AA AA5A AAA3 AAAA A02A AAAA 802A AAAA AA56 AAEA AA02 AAAA 6002 AAAA B0AA AB0A AB02 2AA9 75AA B00A A96A AAD5 AAB0 02AA 6AAA D6AA AAAB 6AA2 AAAD 56AA EAAD 5AAC 36AA A5AA CAA8 0AAA 802A AA75 6A80 AAA6 AA00 AA96 AAA8 2A80 2AA8".
2010-04-26
The same anonymous guest at the Speed Demos Archive is now claiming an astounding 28: "56AA AAAA AABA AAAA AAAA C2AA AAAA AAC2 AAAA AAB0 0AAA AAAA AB00 2AAA AAAB 00AA AAAA AB55 AAAA AAA9 6AAA AAAA AD5A AAAA AAAA AAA9 AAAB 5AAA AAAA AAAA AAAA ADAA AAAA AB55 AAAA AAAD 6AAA AA8A AAAA AAAB AAAA AAAB 56AA AAAA AAAA A82A AAAA B00A AAAA A95E AB55 AAAA AAA6 AAAA A9AA AAAB 55AA AAAE AAAB 56AA AAA5 AAAA B00A AAAA A996 FC02 AAAA AA9A EFC0 2AAA AAAA EB00 AAAA AAA8 0AAA AAAA A0AA AAAA B2AA AAAC 02AA AAAA B6AA AAAB D56A AAAA BF56 AAAA AD56 AAAA F2AA AAAA AAAB F00A AAAA 9AEF C02A AAAA BAC0 2AAA AA9A AAAA A6AA AAAE AAAB 6AAA B5AA AAD5 6AAA AD5A AAAA 02AA AAA8 2AAA AACA AAAC 02AA AAAF 59AA AAAA B55A AAF5 AA95 AA8A ABC0 AAA5 BF00 AAAA 6BBF 00AA AABA C02A AAAF C0AA AAE0 02AA AA56 AAAB AAAB 0AAA B0AA B00A AAB0 0AAB 55AA 96AA AC00 AAB5 6AA6 AAAD 6AAA AAB6 AA2A AAEA AD56 AAD5 AA0A AA95 AACA A80A AA80 2AAA 0356 A80A AA00 AA82 AB6A B56A AD56 ABF0 0AA".
2010-05-04
Slashdot.jp user Deasuke has reached 30: "C02A AAAA AAAB 00AA AAAA AC08 AAAA AAC2 AAAA AAAA C2AA AAAA AEAA AAAA AA56 AAAA AAAA B55A AAAA AA96 AAAA AAAA D5AA AAAA A9AA AAAA AAB5 AAAA AAAA AAAA AAAA DAAA AAAA 9756 AAAA AA8A AAAA AAAB AAAA AAAB 5AAA AAAB 56AA AAAA AAAA A82A AAAA B00A AAAA A6D6 AB55 6AAA AAA9 4AAA AAA6 AAAA AD56 AAAA B56A AAAA 032A AAAA A65B F00A AAAA AA6E EFC0 2AAA AAAA EB00 AAAA AAA8 0AAA AAAA 802A AAAA AA54 AAAA AAA1 AAAA AAA0 AAAA AAA0 0AAA AAAA C02A AAAA B002 AAAA B00A AAAC 2AAA AAB0 AAAA AEAA AAA9 5AAA AAA9 D5AA AAA5 AAAA AAB5 6AAA A6AA AAAB 5AAA AAAA AAAA DAAA AAD5 56AA AA2A AAAA BAAA AAD6 AAAB 56AA AAAA 82AA AC02 AAA7 B5AA D556 AAAA 52AA A6AA B55A AB56 AA80 FCAA AAA5 583F 0AAA A9BB BF00 AAAA AE80 32AA AA82 FAAA A802 AAAA 96AA AA1A AAA8 2AAA A00A AAAB 00AA AB00 AAB0 AAAB 0AAB AAA9 5AAA AD56 AA5A AAB5 6AAC 02A9 AAAB 5AAA AAAD AAB5 5AA2 AAAE AA0A AAB2 AAD5 6AB5 AA02 AAA0 0AAA B55A AD6A BAAC 2AAB 0AA0 C2AA C02A".
Discussion (129)
2010-04-04 00:54:52 by frymaster:
2010-04-04 00:55:20 by Thrack:
2010-04-04 01:00:51 by Sam:
2010-04-04 02:00:44 by Bauglir:
2010-04-04 02:21:15 by JeremyBowers:
2010-04-04 05:15:42 by Aaron:
2010-04-04 06:40:38 by Kazanir:
2010-04-04 07:03:59 by cory:
2010-04-04 09:04:30 by Atypical:
2010-04-04 15:02:13 by Aegeus:
2010-04-04 15:48:38 by Michael:
2010-04-04 15:52:41 by Michael:
2010-04-04 16:06:58 by Sam:
2010-04-05 01:24:39 by Daedalus:
2010-04-05 02:48:26 by Atypical:
2010-04-05 03:01:34 by Atypical:
2010-04-05 03:21:39 by Atypical:
2010-04-05 03:26:59 by sunburstbasser:
2010-04-05 04:47:24 by Andrew:
2010-04-05 06:32:58 by slowbroTom:
2010-04-05 07:01:10 by Lar:
2010-04-05 07:13:07 by Tom:
2010-04-05 07:35:14 by Atypical:
2010-04-05 07:49:14 by Tom:
2010-04-05 15:12:55 by Adam:
2010-04-07 03:48:22 by Thrack:
2010-04-07 05:46:10 by Michael:
2010-04-07 09:18:39 by Tom:
2010-04-07 14:46:16 by Tom:
2010-04-07 16:31:06 by Val:
2010-04-07 16:31:37 by Val:
2010-04-07 18:08:01 by Thrack:
2010-04-07 18:58:41 by Sam:
2010-04-07 19:16:08 by Atypical:
2010-04-07 20:41:27 by Sam:
2010-04-07 22:39:53 by Atypical:
2010-04-07 22:40:09 by Atypical:
2010-04-08 05:29:10 by Daniel:
2010-04-08 12:57:50 by Thrack:
2010-04-09 07:53:41 by Tom:
2010-04-09 21:13:37 by Atypical:
2010-04-09 21:40:22 by Sam:
2010-04-09 22:42:46 by John:
2010-04-10 01:28:43 by anonymous:
2010-04-10 03:35:21 by Tom:
2010-04-10 05:04:41 by Kazanir:
2010-04-10 18:18:52 by Guest:
2010-04-12 21:01:23 by Atypical:
2010-04-13 15:57:04 by Jiaying:
2010-04-14 00:56:52 by ejl:
2010-04-14 03:48:20 by my:
2010-04-14 06:32:38 by EternalDensity:
2010-04-14 16:33:12 by neil:
2010-04-15 17:05:11 by RetroBLM:
2010-04-16 21:59:46 by Ivenris:
2010-04-18 16:46:32 by neil:
2010-04-21 00:04:54 by Power:
2010-04-22 19:02:45 by ReverseEngineer:
2010-04-22 19:13:31 by T:
2010-04-22 19:47:50 by TheGZeus:
2010-04-23 05:12:53 by neil:
2010-04-23 10:54:26 by me:
2010-04-23 11:49:04 by gumboot:
2010-04-23 23:03:09 by Chuck:
2010-04-24 20:28:16 by Kamineko:
2010-04-24 22:48:53 by Sam:
2010-04-25 02:20:09 by dwineman:
2010-04-25 20:04:13 by digarb:
2010-04-25 20:32:10 by Kamineko:
2010-04-25 21:21:52 by Sam:
2010-04-27 22:39:42 by webmaren:
2010-04-28 12:15:24 by Dimatra:
2010-04-29 04:43:22 by Dimatra:
2010-04-29 16:58:24 by Tom:
2010-04-30 15:57:22 by CS:
2010-04-30 16:16:13 by Yan:
2010-04-30 17:32:34 by Guest:
2010-04-30 23:10:10 by Sam:
2010-05-01 06:56:28 by CS:
2010-05-01 13:31:39 by Guest:
2010-05-03 19:31:03 by sone:
2010-05-03 21:13:13 by Sam:
2010-05-03 21:32:05 by Sam:
2010-05-03 22:23:03 by Sam:
2010-05-03 22:42:13 by hasi:
2010-05-03 23:25:03 by Sam:
2010-05-04 01:36:24 by sone:
2010-05-04 04:20:17 by masuidrive:
2010-05-04 09:52:49 by Sam:
2010-05-04 10:33:55 by masuidrive:
2010-05-04 17:02:47 by SlashdotJP:
2010-05-05 11:50:48 by archmond:
2010-05-05 22:51:13 by T:
2010-05-06 00:54:22 by CS:
2010-05-06 02:48:21 by T:
2010-05-06 10:06:03 by Sam:
2010-05-06 12:52:12 by T:
2010-05-06 21:35:06 by Sam:
2010-05-06 21:59:16 by Sam:
2010-05-07 06:54:00 by T:
2010-05-07 18:19:30 by Luke:
2010-05-07 18:46:44 by Sam:
2010-05-10 13:29:18 by bshnet:
2010-05-10 14:14:44 by Sam:
2010-05-19 03:23:13 by Steve:
2010-05-19 08:08:40 by Sam:
2010-06-01 00:19:48 by Hobbes:
2010-10-12 10:12:52 by bottleHeD:
2010-10-12 10:18:52 by bottleHeD:
2010-10-20 23: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 Sam:
2011-02-07 10:11:55 by Rick:
2011-02-07 16:04:23 by Sam:
2011-02-09 11:06:43 by Rick:
2011-03-29 20:25:44 by HydraBurrito:
2011-03-29 21:25:19 by Sam:
2011-04-20 02:21:32 by FinalOne:
2011-04-20 09:23:43 by Sam:
2011-04-22 04:43:19 by wallawalla:
2012-04-22 10:25:04 by Robert:
2012-04-22 10:31:32 by Sam:
2012-04-22 12:26:50 by Robert:
2012-06-10 17:37:59 by Muzozavr:
2012-06-19 18:41:42 by Muzozavr:
2012-08-14 11:20:15 by Robin:
2012-11-05 14:38:09 by Muzozavr:
2013-01-16 03:57:24 by MK:
add comment