Play Hate Tetris.

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".

Back to Code
Back to Things Of Interest

Facebook Twitter Reddit Email Hacker News StumbleUpon

Discussion (131)

2010-04-04 00:54:52 by frymaster:

just to add to your hatred of trying to use javascript, this doesn't work either on ie8 or the ie9 tech preview... works on opera though :)

best score so far is 4

2010-04-04 00:55:20 by Thrack:

1 row is my record after several tries. I've heard of hateful Tetris games before but could never find a copy of one.
Hate Tetris insists on giving me only S and Z pieces so far. I need to find a way to make one of the other 5 pieces the worst, is there a known way to do this?

2010-04-04 01:00:51 by Sam:

If anybody has any idea why they might be experiencing problems running the JavaScript, let me know if you have any suggested solutions because I hate debugging JavaScript on non-Firebug-capable browsers even more than I hate writing it to begin with.

2010-04-04 02:00:44 by Bauglir:

Well, I've matched five, but I can't seem to progress beyond that. Basically I build 3 two-block wide stacks as high as I can with the starting blocks, and then start connecting them. Tends to force the game to allow me to get a row. Got the best results from building three of the stacks adjacent to each other on the far right, then dropping a piece right next to that.

2010-04-04 02:21:15 by JeremyBowers:

Works perfectly on Google Chrome, probably somewhat faster than Firefox (I don't see much of a pause.)

In the crowded field of tetris clones, this may be a genuinely new entrant. You're almost better off never having played it before, standard Tetris involves a lot logic using "well, this piece will come eventually"... NO. No it won't.

I managed 7. More may be possible. You can manufacture a scenario where you have one part of the board much lower than the others, and all the pieces but a certain one of the s or z piece would allow you to complete a line there. It will then give you the "wrong" s/z piece pretty much indefinitely, which you can use to plate the rest of the board, imperfectly but adequately to set up a few more lines.

Also, I was quite excited that I managed to convince it to spawn a square. I wonder if it's even possible to get a T-piece?

2010-04-04 05:15:42 by Aaron:

The canonical "evil tetris" is probably "bastet" for "bastard tetris".

2010-04-04 06:40:38 by Kazanir:

7 is my best also.

2010-04-04 07:03:59 by cory:

I only played for a couple minutes... did terribly, but managed to convince it to give me a long piece. You know, in the one situation where it doesn't help. I think I'll be content with myself if I can convince it to give me an L piece... nevermind trying to actually get a few rows down.

2010-04-04 09:04:30 by Atypical:

11, here is a video: http://atypical.rafe.name/Atypical%20-%20Hatetris.wmv

A friend linked me this game, and about 3 hours later this is the best I could do. I think it is possible to get maybe 13 or 14.

I haven't really looked into how the game was coded, I'm just an experienced gamer and quickly found at least one abuse of the AI which is to create that slope from left to right with a hole on the right, from what I can tell the AI has to choose between giving you 1, 2 or 4 lines the entire time.

The video is slightly sped up, no godmode here.

2010-04-04 15:02:13 by Aegeus:

The reason most bastet games don't give you the absolute worst pieces is that that gets boring. You end up with nothing but S and Z pieces (though I'm amazed that yours handed out I pieces, and still made them problematic). What would really impress me is one that was subtle enough to convince you it was just the RNG messing with you. For example, one that plays normally, but if there is only one piece that can fit in a situation, it doesn't give it to you, or if there is a piece that you cannot place anywhere without leaving a hole (for example, a box when you have no flat surfaces in your stack), it gives you that piece. That would be a really vicious tetris game, because you wouldn't expect it.

2010-04-04 15:48:38 by Michael:

I also used to hate javascript. The saving grace for the language comes in the form of a couple of frameworks: jquery.com and prototypejs.org (though, I prefer prototype)

Takes care of most of the nasty cross-browser bugs and adds a lot of features and syntactical sugar to the mix.

Seriously give it a shot, you'll thank me.

2010-04-04 15:52:41 by Michael:

Oh, and you could also try using a min-max search with alpha-beta pruning to achieve some truly evil efficiency.

2010-04-04 16:06:58 by Sam:

It looks to me like minimax is exactly what I'm already doing ("for each piece, calculate the maximum (best case scenario); return the minimum of these maxima") and alpha-beta isn't meaningful when you are already only looking one move ahead.

2010-04-05 01:24:39 by Daedalus:

Sam: I'm assuming he meant minimax, looking ahead several plies.

That would be quite impressive, actually, and I doubt it would slow the game down too much to be worth it.

Nice CAPTCHA; it weeds out bots and mathematical illiterates! ("the square root of minus one")

2010-04-05 02:48:26 by Atypical:

Has anyone beat 11? =)

2010-04-05 03:01:34 by Atypical:

I tried a few of the other versions of this super hard tetris, I can safely say this one is the hardest I've seen. I think the decision process for what is the worst piece is fairly solid here, if not the best possible (worst possible pieces).

But really, the only way to make a tetris game more difficult than something like this (while remaining random-free) is to make the pieces adapt to the player, which would probably have to be done over the course of a few games, but could be done on a per-game basis too.

It becomes similar to Chess AI, where the game would have to adapt to not only the current playing field, but future possibilities. Much like writing Chess AI, you'd probably have to hard-code specific situations which lead to AI-abuse, too. Then again I don't know what I'm talking about.

2010-04-05 03:21:39 by Atypical:

Sorry for the multiple posts but I just remembered I wanted to mention that there might be a simple deterministic solution to players abusing the AI: It seems like there is an order of pieces which it analyzes in order to determine which is the worst (starting with S) and when there are a lot of equally bad peices, it will predictably choose one in order (which gives the player too much insight into which piece will come next).

If you were to find a way to mix up the pieces when they might be equally bad, while leaving the AI as it is for counteracting useful pieces, it should make it more difficult. Off the top of my head, one method might be to avoid giving you a piece which it has just given you a bunch of in a row when another one might be equally as bad (counting how many of each piece it has given you). Of course, still giving decision priority to the current way of doing things.

This might overcomplicate things but it is worth a shot.

2010-04-05 03:26:59 by sunburstbasser:

I did manage to finish off this round with the L piece. Nice replay feature, Sam. So far I haven't gotten the reverse L or the T, in other attempts I've gotten the other pieces. No squares this time.

AAAA A08B 2AAA 0BAA AAAA AABA AAAA AAA9 E6AA AAAA A395 9A66 AAAA AC2A 06AA AAAA E2AA AAAA 9EAA AAAA 8222 322A AAA9 9E6A AAAA A742 88A8 9AAA ABAA 5A66 AA7A A6AA AA0C A08A AAAA 8AAA AAAA 7666 6AAA A9EA A6AA A023 2AA7 8CAA A876 99AA AA82 AAAA AA36 AAAA 9A0A 2AAA 8C22 8AAA 9AAA AA9C AAAA 7AAA A9D0 CA1A AA74 3022 2AA9 D5AA AA9D A666 A0C8 8A9A AA8A AAB5 66AA 7A9A 890A A8D5 99A6 DABA A02A A201 F632 8

2010-04-05 04:47:24 by Andrew:

Oh god, my high score is 3. That was awful.

2010-04-05 06:32:58 by slowbroTom:

The only "hard" kind of Tetris I had ever seen before is really fast Tetris. This is totally new to me, and extremely interesting!

My first game I thought I was doing well at first, but of course I never got the piece I wanted when I needed it. I got a zero :)

Here's my personal best (7) if anyone wants to see it. I really only found one scenario to abuse (and used it three times).

5555 6AAA AAAA AAAA 6AAA AAAA A8AA AAAA AA80 1AAA AAAA AA9D 5AAA AA97 6AAA AAAA D9AA AAAA AB9A AAAA AABA AAAA AAAC 1AAA AAAA B0CA AAAA AAA8 0AAA AAAA AA33 C2AA AA80 6AAA AAA9 5F00 DD4A AAAA AAAA C00A AAAA AAAA AAA8 2AAA AAB0 00AA AAB0 0AAA AAB0 2AAA AAC2 AAAA B2AA AABA AAAA 95DA AAAA AD6A AAAA 956A AAAA A5AA AAA8 0AAA AAD7 5AAA A801 AAAA 95AA AAA6 AAAA AAA7 55AA AB56 AAB5 AAAD AAEA A80D 6AA0 02AA AA02 AAA0 02AA 95AA 5AA0 EAA4 AA30 0AAC 2A

2010-04-05 07:01:10 by Lar:

Has the fact that all the pieces will be created been confirmed in the wild? it seems that there are very very few, and possibly no, cases where a T piece is the least useful.

2010-04-05 07:13:07 by Tom:

I don't know about all pieces, but T pieces are confirmed in:

C02A AAAA AAA9 5AAA AAAA AA56 AAAA AAAB 002A AAAA AAC2 AAAA AAAA AAAA AAAA A9AA AAAA AA55 AAAA AAB0 4900 AAAA AAC0 6AAA AAAA AAAA AAA9 6AAA AAAB 55AA AAAA AAAA AB55 AAAA BF55 AAAA D56A AFD5 6A

2010-04-05 07:35:14 by Atypical:

Yes, all pieces, including T and the backwards L.

2010-04-05 07:49:14 by Tom:

All seven pieces in one (low-scoring) game:

56AA AAAA AAA6 AAAA AAAA AA56 AAAA AAC0 2AAA AAAA AB02 6AAA AAAA AAAA AAAA AC02 AAAA AA96 AAAA AAAA AAAA AAA7 56AA AAA8 0FD6 AAAA AAAF 02AA AAAA 95AA AAAA 6AAA AA81 AAAA AA80 AAAA ABF0 0AAA AA95 6AAA AA9A AAAA 2AAA AA80 2AAA A956 AAA9 6AAA AAAA ABC2 AAAA EAAB AABA 8

2010-04-05 15:12:55 by Adam:

I get nothing but S pieces.

2010-04-07 03:48:22 by Thrack:

Nice video update, I was wondering how people were coming up with hexadecimal versions of their games until I played the game again (perhaps an 'updated' icon of some sort should be shown on the main qntm page to make updates obvious?). I thought at first that there was some standard for recording tetris games that I wasn't aware of.

Here are two games where I try putting two S blocks on either sides and then fill the space on top with I blocks until it gives me another S block for me to get a row with. Unfortunately I can only get three rows this way before it breaks down but I was able to use follow-up patterns to get five and four points out of them, respectively. This makes my record 5 points.
Can anyone get improvements out of this? I couldn't....

00CA AAAA AAAB 55AA AAAA AAAE AAAA AA5A BAAA AAAA 0ABF 5558 0000 5555 555A AAAA AAD5 AAAA AAAD 6AAA AAAA B000 00AA AAAA B00A AAAA AAAA AAAB 02AB FAAA AAAA AAC6 AAAA AA12 B556 AAAA A9D6 AAAA AC00 00AA AAAB 00AA AAAA C0AA AAAB 0AAA AAAD AAAA AAAB AAAA AA9E A6AA AABA AAAA AD55 6AAA AB6A AA9A BAA8 0002 AAC2 AAAA BEAA AFFF FFFF FA45 B56A AAAC 0AAA ACA8 0AAD 55AA AB5A AAB2 AAA4 4606 AAA0 C2AA B55A AAD6 AAB6 AA0F D555 55AA B00A ACAA 860A AB54 1AD6 9AA3 DAA0 CA8

D55A AAAA AAAD E8C0 AAAA AAAA BF5A AAAA AAAA FC2A AAAA AAAB 000A AAAA AAD5 6AAA AAAA FFD5 AAAA AAA0 C2AA AAAA AD6A AAAA AAC2 AAAA 8AAE AAAA AAAA CAAA AAAA B000 AAAA AB55 AAAA AAD5 AAAA AB00 AAAA AAC0 AAAA AB0A AAAA ADAA AAAA AB5A AAAA ABAA AAAB FBFE FFFB 5AAA AAFF FFAE AAAA AD55 AAAA AC00 AAAA AD6A AAAB 0AAA AAD5 6AAA BEAA AAB0 0AAA AB02 AAAB 2AAA B56A AABF 6AAA AD54 16AA C08A AC2A AD6A 8111 6EBF FFE8 4A36 A

2010-04-07 05:46:10 by Michael:

Daedalus, you've got the idea. In this case, the AI finds the piece that minimizes the player's score, predicts the move that maximizes the player's score, and so on... Also, by score I mean whatever heuristic function you're using to evaluate states. Even if you're only looking 4 or 5 ply deep it gives you a pretty manageable state-space with some good improvements. AB-pruning helps reduce that state-space even more.

2010-04-07 09:18:39 by Tom:

Atypical, I just got a 12. I used your beginning strategy (twice kind of), so you get at least half the credit, probably a lot more. I can't believe the game let me do what I did at the end :S

12:
C02A AAAA AAAC 02AA AAAA AC02 AAAA AAC0 2AAA AAC0 2AAA AC2A AAAA AAAC 2AAA AAAA C2AA AAAA EAAA AAAA AEAA AAAA AEAA AAAA D6AA AAAA AAD5 6AAA AAAA AD6A AAAA AA95 AAAA AAAA 6AAA AAAA 56AA AAAA AC2A AAAA A8AA AAAA A6AA AAAA 95AA AAAA A02A AAAA A2AA AAAA 6AAA AAA5 6AAA AAA0 0AAA AAA0 AAAA AAAA AAAA 5AAA AAA3 F02A AAAB 00AA AAC2 AAAA EAAA AD6A AAAD 56AA AAAC 00AA AC02 AAAC 0AAA B0AA AACA AABA AAAD 56AA AAB0 0AAC 2AAD 6AAA A56A AAA6 AAA9 5AAA A2AA A6AA A56A AA00 AAA0 AAAA AA5A AAFC 02A9 5AAB 55AA 6AA6 AB0A FADE C02A 82AA 8


The best I have done without copying Atypical is only 8:

C02A AAAA AAAB 00AA AAAA AB00 AAAA AAB0 0AAA AAB0 0AAA AB00 AAAB 00AA B0AA AAAA AAB0 AAAA AAAB 0AAA AAAB 0AAA AAB0 AAAA B0AA ABAA AAAA AABA AAAA AABA AAAA ABAA AAAB AAAA 95AA AAAA AAA5 AAAA AAAA 95AA AAAA AA5A AAAA AA95 AAAA AAA5 AAAA AAB0 0AAB 00AA C2AA AB0A AAEA AAAB AAAA 56AA AAA9 6AAA AA56 AAAA B6AA AAAA AAB6 AAAA AB55 AAA9 6AAA AD56 2AAB 6AAA AC02 AAC2 AAAD 56AA C2AA 6AAA AAAA C02A B0AA D55A A6AA AAAD 6AAA A8

2010-04-07 14:46:16 by Tom:

Your game has gained some attention in the speeddemosarchive.com forums. I posted about my 12 and the odd circumstances of the final line, and tjp7154 offered a likely explanation along with example games, and I think he's right.

It's the fourth post of this page:
http://speeddemosarchive.com/forum/index.php?topic=11523.15

Apparently, the game does not detect opportunities to make lines if to do so the piece has to be rotated into a small gap. Pieces usually refuse to rotate into small gaps, but if they have already been rotated 180-270 degrees beforehand (and it may only work if the piece enters the gap from the left) then they can.

2010-04-07 16:31:06 by Val:

Does the xkcd guy reads qntm? (http://xkcd.com/724/)

2010-04-07 16:31:37 by Val:

I mean, read

2010-04-07 18:08:01 by Thrack:

"Apparently, the game does not detect opportunities to make lines if to do so the piece has to be rotated into a small gap."

I had been wondering if the program checked for that or not but never got a chance to really find out! (I did have an opportunity to rotate an I block into a gap once but then messed it up.) I figured it probably didn't because it would require many more checks, a lot of which would be difficult.
Since its a certainty now I'll look for ways to abuse it.

2010-04-07 18:58:41 by Sam:

I've isolated the reason for that bug but solving it may be a little complex. It's not a simple pathfinding issue: the algorithm is capable of doing anything that you can do (in fact the AI tests input moves using the same programming interface that you use while playing live and that the replay mechanism uses). The bug is a little more complex than that. I can't fix it right now though. Bear with me.

2010-04-07 19:16:08 by Atypical:

@Tom: Nice job on getting 12. I knew it was possible because in my run everything past 6-7 was improvised and poorly done. I think 14 might be the highest possible score.

The abuse that I found seems to yield the most lines with the least height, I have been looking for a way to do it more than once in one game, the way you did.

About the rotation bug; I've had friends of mine attempt to revolve entire strategies around sliding a piece into a small space via rotation to no success. The only thing this does allow you to do is use pieces in an order that it would not have given you otherwise, but usually does not give you more than one line.

I've been trying to find a new abuse, but the only general rule which seems to apply in every case is to never leave one less block on the end of a line (---------.). That saves a lot of frustration.

2010-04-07 20:41:27 by Sam:

Right.

Start a new game and hit "rotate" four times. Note what happens to the piece. Unlike many Tetris games, the rotation process is actually mathematical; each new piece rotates around a "point of origin" which is at the junction point of four squares. The rotation is performed by fiddling with the actual coordinates of each of the four "bits" which make up the piece. Each piece actually has a point of rotation in addition to everything else.

The algorithm which tests all the possible positions, actions and final resting places of each possible new piece can do anything you can do: left, right, drop, rotate. The algorithm stores a list of all of these locations and applies all possible transforms to each location in turn in order to generate a complete list. Obviously, each new location thus generated has to be compared with the whole list to make sure it is new. One of my early attempts to make the algorithm faster made it so that it only checked the locations of the four bits, not the central point of rotation.

However, in the case of an S or Z piece, the point of rotation is significant. Hitting "rotate" will result in a different piece depending on which way up the piece is. In Tom's 12-point run, the algorithm moved an S piece to the same location as he did, and hit "rotate", but because the piece was the other way up, resistance was encountered and nothing happened. With the piece the other way up, which is what Tom did, the rotation is successful and a line is made.

This cut for efficiency doesn't seem to save much time anyway so I've simply removed it. The algorithm now runs as normal but returns a square instead of an S at the critical point. Tom's run becomes an 11-pointer.

I apologise to Tom for ruining what was briefly a record run, but I think we can all agree that the run arose from a bug in the program and we are all better for having that bug fixed. Best of luck to all of you going forward!

2010-04-07 22:39:53 by Atypical:

Beating my just wasn't meant to happen.

2010-04-07 22:40:09 by Atypical:

me*

2010-04-08 05:29:10 by Daniel:

A while ago I read about Bastet and thought of a way to improve it: Make it a two-player game. One player (currently the AI) chooses the pieces, while the other (currently the human) plays them. That way you could watch the computer play itself, or have two humans play each other.

With the current method, there's only one result if the computer plays itself. I wonder what it is.

If you go for the "making it look like an ordinary game of tetris" perhaps you should make it weight the pieces so it drops the same number of each piece on average, but always drops them at the worst moment.

2010-04-08 12:57:50 by Thrack:

I had that idea several days ago Daniel. I would make it (I've made a few small games by now and tetris doesn't seem too hard, in fact I've been considering it anyway for other reasons) but I've got a few other projects going on at the moment. But maybe I'll try it within a couple weeks anyway if I get time.

2010-04-09 07:53:41 by Tom:

Wow :D Congratulations on completing a fix so quickly. Obviously I agree that I only got my last line through an exploit, so I was never a rightful record holder.

A guest at SDA achieved a 17, and posted the move sequence a little farther down that same page.

2010-04-09 21:13:37 by Atypical:

The same guest hit 20, very impressive. Not to mention the approach he took looks very counterintuitive at first, placing all the T blocks in such strange positions, but you can't argue with results. Great job!

2010-04-09 21:40:22 by Sam:

Okay, the 20-point run is very, very impressive. I don't know how that person came up with that strategy - which seems to be like the exact negation of every sensible Tetris strategy - but it's far too effective.

I think I'm going to have to undo a little optimisation work and create a harder algorithm which looks more than one move ahead to give you bad pieces. I think I'll probably also make it try to give equal quantities of all pieces to make it less easy to predict.

Ultimately, since the AI is encoded in public JavaScript, all of this is going to boil down to computing power. The question is how much time you want to spend searching all future possibilities to see what would make for a good strategy. I'm pretty sure it's possible to force you to get no lines, the question is how?

2010-04-09 22:42:46 by John:

I noticed you don't have a license on the code. Do you want people to be able to modify and distribute this game? May I suggest the MIT license?

2010-04-10 01:28:43 by anonymous:

Make a "current replay" that is always visible, and is appended to with each keypress. When pasting a replay that doesn't produce an endgame state, allow the user to continue playing the game. Allow skipping to the end of a replay. This would let people paste their opening strategy for others to continue.

2010-04-10 03:35:21 by Tom:

I bet you will succeed at making Hatetris even tougher :) but I hope you also leave the current version of the game online. It's a lot of fun just the way it is, and it's even more fun to watch the awesome work of players like Atypical and the guest at SDA.

2010-04-10 05:04:41 by Kazanir:

The game is simple and elegant as it stands. Unless someone finds a way to truly infinite-loop the game then it should stand as it is. It's a great game to introduce into an unsuspecting IRC channel.

2010-04-10 18:18:52 by Guest:

Hello, I'm the person that got 20. Sorry about finding such an effective strategy. As the AI is completely deterministic (thank you for this), and there isn't any gravity, this game of Tetris is essentially a puzzle.

The strategy may appear slightly nonsensical, but there is a certain logic behind it. Firstly, forcing the AI to only give out certain kinds of pieces. It defaults to S-pieces if there are no significant differences between pieces, or if every piece can make a line (even if it might not be the most obstructive). Other pieces can be forced to spawn endlessly, as long as you can not make a line with them. (One exception, occasionally exactly 1 L or J will spawn.) Once it is possible to make a line (or several) with every piece, the game will spawn nothing but S-pieces, presumably because the AI gives up looking for the worst possible piece.(As an aside, in my opinion, this game needs more Z-pieces and O-pieces, as these are usually also quite obstructive.)

Secondly, the AI has absolutely no concept of planning ahead. It does not think e.g. if I give you this piece, can I prevent you from getting a line next piece? Even something as simple as this, I believe, would make the AI much more troublesome. It also does not see if you are using the current (forced) piece to build up a solid stack of pieces. It will just give you the same piece over and over again until it is commanded to stop (i.e. you can make a line with said piece). This, however, would take much more complex AI to prevent (probably).

Thirdly, as a person, I can plan ahead. I can safely leave holes in lines which I know shall never be cleared to modify the build pattern. I can build right to the top, safe in the knowledge of what pieces are coming, and that I will clear lines to bring everything down. There is no need to take a line immediately, if it will help make more lines later. I can manipulate the AI to give certain pieces and not others. As there is no randomness, every piece can be planned, and a solution can hopefully be found to this puzzle.

Hopefully, this will give some insight as to why my strategy works so well. Maybe this will help you make a more difficult AI. I do ask that you keep the current version up, because it still works reasonably well, and as to not invalidate everything done so far.

With regards to piece balance, maybe it would be good, maybe it would not. Just as an example, my 20-point game had 46 S-pieces, 19 T-pieces, 14 I-pieces, 1 Z-piece, and none of the others. This is not even close to an even 1/7 spread, so it certainly would change things.

Sorry if this post is a complete waste of time.

2010-04-12 21:01:23 by Atypical:

Yes, that touches on a possible alternative to the AI. As I we all know there is an order of pieces which are checked, which imbalances the piece frequency (making S by far the most popular). There are some non-random methods of adding variety to the pieces it gives you; if two pieces are deemed equally as bad, if it were to simply give you the one which you have received less of up until that point, the game might be equally as difficult yet not as repetitive.

This would add another dimension of planning ahead, which when fully mastered I could imagine would lead to an infinite loop of lines in a game which on the surface would still seem impossible.

2010-04-13 15:57:04 by Jiaying:

There might be a strategy to beat the algorithm. Probably playing randomly is one.

My top score is 5: replay of last game: AA00 3555 5AAA AAAA A00A AAAA AAAA AAA8 AAA0 8A6A AAAA AA08 95D6 AAAA AAA9 B6AA AAAA 9B6A AAAA ABAA AAAA A2DA AAAA A57E DAAA AAAA 572A AAAA 576A AAAA EAAA AA57 0037 5A9A AAA5 D5AA AA80 14DA AAAA AA80 3DBF 076A AAAA 83B5 EAAA A0EA AAA9 7AAA A00A 9DAA 830A 9555 6ABA AA80 3AAA AAAA 808E AAAA AA02 CAAA AAA1 5400 C2AA AAA8 D5AA AA8C AAAA A365 56AA ABAA AA80 C952 AAA3 0055 5AAA A0C0 AAAA 805D 55AA AAEA AA8D 3D54 002F 5554 32AA 8C09 AAA3 555A AAC5 6AA8 02AA 92AA 0355 5002 A95A A00E A

2010-04-14 00:56:52 by ejl:

@previous post

Well of course, you could play randomly, blind mountaineers/hill-climbing and all that. You just won't do very well :-)

2010-04-14 03:48:20 by my:

19:
A59A AAAA AAAA A9AA AAAA A8AA AAAA ABA2 2222 AAAA AAA6 992A AAAA AB65 9A6A AA88 AAAA AAAA 9E66 A9AA A967 AAAA AAAA A9AA AAA2 22AA AAAA AAA6 AAAA AAA2 222A AAAA AAA9 68AA ABA2 222A AAAA A8AA AAAA AA96 AD6B 566A AA9A 9AAA AA88 AAAA AAAA 6B5A AAAA A6AA AAAA 22A8 AAAA AAAA A6AA 2888 8AAA AAAA 9AAA AA38 888A AAAA 8AAA AAAA 96AA AB3A AAAA AA99 ADAA AD56 AAAA 9AAA AA22 2AAA AAAA 16AA AA22 222A AAAA 9AAA AAA2 AAAB 8A22 22AA 895A AAAA 22AA AAA5 68D6 DA6A 6AAA 9AAA A222 AAAA A9AA AA22 222A AAA9 AAA8 8A6A AB02 88AA A5AA AAA2 2AAA 75AA A9AA AAA2 22AA B556 AAAA 6AA8 8888 AA6A AAA2 AAAC A222 225A AAA2 2AAD 5AA9 AAA8 82AA 9D50 3AAA 2888 8AD5 6AA6 AA8A A80A AA6A A00A AA96 AAB0 AA00 BA

2010-04-14 06:32:38 by EternalDensity:

Reminds me of this tetris-related theses http://www.iam.ubc.ca/theses/Brzustowski/brzustowski.html which of course I found via xkcd.

2010-04-14 16:33:12 by neil:

I implemented HATETRIS in RPython, and created a "player" AI based on the AI giving out the pieces. In a similar fashion, this one just iterates through every possible move, looking for the one that gives the best (lowest) height of the well.

The basic version that does no lookahead (ie. just plays the best move as calculated by the piece-selection AI) does really badly, getting no lines. By looking ahead one move (piece) it manages to get one line, but probably more by luck than good planning, since looking ahead 2 moves gives no lines. Unfortunately more than 2-3 moves of lookahead rapidly becomes impractical: at the moment, my (rather slow, admittedly) laptop is churning through a 3-move-lookahead algorithm at a rate of ~3 hours/move.

I'm not sure if a more efficient algorithm is possible. Given the power of existing chess AIs, it doesn't seem like it should be unsolvable; tetris is so much simpler than chess.

2010-04-15 17:05:11 by RetroBLM:

I've only managed to get 7 so far. I'm still happy with it, though.

DDD9 AAAA AAAA AAA9 D5AA AAA5 5DAA AAAA A955 D55A AAA9 5DAA AA95 7555 5555 55AA A875 55AA 8032 AAAA AAAA 000C AAAA AAA8 0CAA AAAA 800C AAAA A800 32AA AA00 0CAA A800 CAAB 99AA AAAA AAAA 9DAA AAA9 A6DA AAA1 D9AA AAAA 8D99 AB66 AAAD 9A83 9369 AAAA AAAA 0AAA AAAA A8DA AAAA AAA0 D9AA AAAA EAAA AAAA 0EAA AAA8 CAAA A7CA AA8D AAAA AAEA AAAE AAA9 5DAA A800 32AA A302 9576 AB66 AA76 A8E6 AA36 A83A AAAA 8CAA AA83 AAA8 4000 0AAA 759A A76A A36A A0FA A9D5 AA76 A8DA A00A A801 6A

2010-04-16 21:59:46 by Ivenris:

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

My eyes turned red when I was trying to beat the previous score (20)
I think this is not the highest result and I hope someone could use it to achieve more! :)

2010-04-18 16:46:32 by neil:

Well, looking ahead three pieces causes my AI to get a whopping 2 lines.
If anything this is interesting because it shows how much forward planning we humans do to get such high scores as 22. It also shows how much more power the computer AI has compared to the player - in order for a player to do any good, they have to be not just one step, but several steps ahead of the AI at all times.

2010-04-21 00:04:54 by Power:

I do think it is impossible to design Hatetris to prevent the player from gaining any lines. An easy way to force scoring is rather simple: build your pile to score if given any of the 7 pieces in the game.

As for changes to the AI, the only thing I can think of that can't be exploited would be to random what piece is chosen to drop if there are multiple worse choices. For example, S and Z pieces are equally bad at the beginning of a game.

My personal best so far has been a score of 9.

2010-04-22 19:02:45 by ReverseEngineer:

So, if I were to write an algorithm to try to beat hateris, I believe it would be a Maximinimax algorithm - find the worst choice that will result in the best worst outcome.

Or is the best choice that would result in the best worst outcome?

2010-04-22 19:13:31 by T:

"Yes, the game is written entirely in JavaScript. Very few real games are amenable to this"

Not quite true. There was a Lemmings port a year or two ago, and some folks at Google made Quake II run entirely in HTML5 and Javascript.

2010-04-22 19:47:50 by TheGZeus:

I also would like to see a license for the code.
Theoretically this could be played offline as will as online.

2010-04-23 05:12:53 by neil:

Well, you can just save the webpage onto your harddisk. That's a kind of "offline" :)

2010-04-23 10:54:26 by me:

A few hints on the controls would be nice. How do you rotate the pieces?

2010-04-23 11:49:04 by gumboot:

If you find more than one candidate for the next block, you might consider breaking that tie using the _best_ candidate from the round before. This improves the chances of giving the player the block that they really wanted as soon as it's too late.

2010-04-23 23:03:09 by Chuck:

I think i know how to make the algo much more evil, and simpler to implement.

Give the I the "deep drop" capability.

Have it check not only positions it knows you can get to, but any spot where there's enough space for the peice to land, whether or not it's reachable.

This would stop many of the abuses.

2010-04-24 20:28:16 by Kamineko:

Hey - neat idea, but could you post a guide to the keyboard controls? Or is it deliberate that you can't rotate the pieces?

2010-04-24 22:48:53 by Sam:

Uh, guys, with all due respect, if you haven't figured out that pressing Up will rotate the piece, HATETRIS is not for you.

2010-04-25 02:20:09 by dwineman:

It's absolutely possible to change the algorithm without invalidating replays: versioning. Keep the code for the old algorithm and use it just for old replays. Add a prefix to replays of new games indicating that they use the new algorithm. Now you can change the algorithm whenever you want; just remember to bump the version number each time and don't throw away the old code.

2010-04-25 20:04:13 by digarb:

My personal best is 8 lines with nice pattern:
C002 AAAA AAAA CAAA AAA8 AAC9 AAAA AAAA C2AA 00AA AAAC AAAA 2AAA DAAA AA2A ACAA A2AA AC55 542A AAAA AAAC 56AA AAAA AC00 162A AAAA B000 AAAA AAFD 5550 AA90 0000 AB00 AAAA B02A AAAB 2A8A AAAE 2AAA AAEA AAAA AD6A AAAA B002 AAC2 AAAE AAAA D6AA AAAD 556A AAAA AAAD 55AA AAAA AB00 02AA C8AA AEAA AAD6 AAAA AD55 5AAA AAA9 56AA AAAA A9AA AA2A AA82 8AA9 56AA AAAA A6AA 8AAA A556 AAAA 9AAA A955 6AAA AAAA C00E C2AA A72A AAD6 AAA0 02AA 0AAA AA5A AB55 AAAA D56A FAFE 800A A0AA 4AA5 AAD5 6A

2010-04-25 20:32:10 by Kamineko:

Sam, with all due respect, if you can't be bothered to take the 30 seconds to write down a quick guide to the controls to your game, then maybe game development isn't for you. But yeah, I guess it's us who are all stoopid for not figuring out that it was the 'Up' key that rotates the pieces - because that's what it is in every other Tetris game. Oh wait...

2010-04-25 21:21:52 by Sam:

Uh, yeah, pretty much. Sixty thousand other people figured it out.

2010-04-27 22:39:42 by webmaren:

I think I have figured out a better algorithm. Instead of evaluating the board to try and minimax the height of the field, minimize the number of possible line scores.

You set up an array:
pieces[0] = [numLines]

Then when iterating through the possible drops, increment numLines each time a complete line is made. Select all of the pieces that have the minimum number of possible line scores, and give the player a random block from that list. The only situation that forces a line should be:

x x x _ _ x x x x x
x x x _ x x x x x x

or a horizontal flip of that. No algorithm can block a line there because every one of the pieces fits. But I doubt you'd be able to get it more than three or four times in one go.

2010-04-28 12:15:24 by Dimatra:

I got a score of 21. I copied the beginning a bit from the last ones and came up with a new tactic in the end. I wonder, if this could be improved:
C00A AAAA AAAB 0AAA AAAA AAEA AAAA AAAC 00AA AAAA AB0A AAAA AAB0 0AAA AAAB D556 AAAA AAAA B556 AAAA AAA5 AAAA AAAA D5AA AAAA AA75 56AA AAAD 55AA AAAD 55AA AAB5 5AAA D56A 6AAA AAAA AB5A AAAA AAAA AAAA AAAD AAAA AAAB 5AAA AAAD 6AAA AB5A AAB5 AAAB 55AB 5AA2 AAAA AAAA BAAA AAAA 82AA AAAA AAEA AAAA BAAA ACAA AAAA AB55 AB5A AC3A AAAA AAAA 0002 AAAA AAAA D55A AD6A 0AAA AAAA AEAA CAAA AAAB 000A AAAA AA80 AAAA AAA9 D56A D6A8 000A AAAA AAA0 AAAA AABA ACAA AAA8 03AA AAAA 80AA AAAA B55A AD6A A00A AAAA AAD5 6AD6 A82A AAAA B2AA A830 AAAA A80A AAAA 802A AAAA 0AAA AB00 02AA AAAA AAC0 00AA AAAA BAAA D40A AAD5 6AAD 6AAC 02AA AA80 AAAA B55A AD6A AEAA 00AA AAAD 56AD 6ABA A02A AAA0 0AAA 80DA AB0A AC02 AAD5 6AB0 0AAD 416A 82AB A8

2010-04-29 04:43:22 by Dimatra:

23
EAAA AAAA AB0A AAAA AAAB 0AAA AAAA B00A AAAA AAAB 00AA AAAA AB00 00AA AAAA 956A AAAA AAAB 55AA AAAA A96A AAAA AAAD 69AA AAAA 9AAA AAAA AB5A AAAA AAAA AAAA AAAD AAAA AAA2 AAAA AAAA BAAA AAAA B55A AAAA AAB5 6AAA AAA8 2AAA AAAA AC6A AAAA 956A AAAA A955 56AA AAAA 556A AAAA 9556 AAAA A54A AAAA 54D6 AAA9 6AAA A5AA AA5A AA5A AAB2 AAAA AAA0 2AAA AAAA A000 AAAA AAAA 82AA AAAA A035 AAAA AAC0 2AAA AAAA 02AA AAAA A00A AAAA AAB5 5AAA AB51 AAAA D56A AB5A AAF2 AAAA AABA AAB0 0002 AAAA AAAA B2AA AAB0 5000 AAAA AA80 AAAA AA80 2AAA AAA0 AAAA AD5A AAAD 6AAB 5556 AAAA D2AA B6AA 8EAA AA03 0AAA AA80 AAAA A800 AAAA AB55 AAAD 56AA 76AA 82AA AAEA AB2A AB00 AAAA 80AA AAB7 00AA AAB5 50AA AB55 AAAD 56AB 5AAB AA80 AAA6 C02A AAD6 ABAA 02AA A00D 5556 A802 AAAD 6ABA A036 AA83 AA0C 0AAA AAAB 00AA B55A AE8

2010-04-29 16:58:24 by Tom:

@ Dimatra, Ivenris, and of course the SDA guest:

All I can say is wow :) I hadn't checked back for a while. I really expected the 20 to still be the world record, but three different people have pushed the game even farther.


Good luck at creating the true Hatetris II! (the one that never allows a single line) The advancements you have made sound exciting. I have no objection to receiving a disproportionately large number of S and reverse S pieces myself :)

2010-04-30 15:57:22 by CS:

based on the 28, this run gets 29:
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 ABC0 2A97 0D5A AC01 5557 0001 5557 0A

2010-04-30 16:16:13 by Yan:

Yeah. Seems the 28 runner missed the very last possible line.

2010-04-30 17:32:34 by Guest:

Okay, point of order.

Not to discredit anyone (or sound like a sore loser), but I must point out that the algorithm has been tweaked (presumably for speed, the game is running faster).

You see, the last piece in my replay was originally an L-piece, which either doesn't make a line, or ends the game. It has changed into a S-piece, which makes a line safely, however it is rotated incorrectly. CS's replay rotates this new S-piece correctly, and makes a line. The problem is, this S-piece is not the worst piece, and not what I was originally given.

I am not sure why this is. Maybe it now doesn't realize that making a line with an L-piece will go too high and end the game (before the line is counted), therefore not making a line. The point is that something broke, allowing an extra line, which previously did not (and presumably should not) exist.

Sorry, but I'm calling a technical foul on this, and I feel this needs to be addressed.

2010-04-30 23:10:10 by Sam:

Thanks for the heads-up.

Yes, I've incorporated some substantial changes to the algorithm (originating from my efforts to create Hard mode - no luck so far) which make the algorithm much more efficient. I had hoped that these changes would not alter the original behaviour of the algorithm but it looks like a small alteration has snuck in.

When HATETRIS was first released several people complained that the game registers a "piece above the bar" BEFORE it begins calculating "lines that you have made" whereas supposedly traditional Tetris behaves in the opposite manner: it doesn't matter if the tower goes above the bar as long as, in doing so, the user makes a line which instantly moves the tower back below the bar afterwards.

While optimising HATETRIS I altered this behaviour (it also makes the algorithm fractionally faster) but in uploading these alterations it looks like I forgot to alter the behaviour back to the norm again. I've uploaded a version of HATETRIS which should resolve this problem (while invalidating the 29-point run). Apologies for this false positive, and thank you very much for catching it. I think we can all agree that everybody benefits when the game behaves consistently.

2010-05-01 06:56:28 by CS:

It did seam a little odd to me that the one extra line was missed!

My incremental minor improvement stand invalidated, but I take full credit for finding the bug.

2010-05-01 13:31:39 by Guest:

Sorry to waste more time, but I think I found two more broken things.

First, I think I was wrong in my thoughts as to the cause of the previous bug. Although that may have needed to be fixed, it may not have been the root cause. I now think that the algorithm is not checking what piece gives the highest peak correctly.

Two (incomplete) replays:

56AA AAAA AA9A AAAA AAAA 2AAA AAAA A802 AAAA AAAA B2AA AAA2 AACA AAAA AA95 AAAA AAAA 6AAA AAAA BAAA AAAA F59A AAAA ABD6 AAAA AAD5 6AAA AAA0 0AAA A9AA 6

5AAA AAAA AA0A AAAA AAAA

When the first replay ends, it gives an S-piece. I believe that this differs from what would previously happen, which is to give an L-piece. When making the line, the L-piece's peak is 1 block higher (two above where the line is made, and one above the rest of the stack) than any other piece (the S and O-pieces are even with the rest of the stack, and the Z, I, J and T pieces all make two lines). If you place the L-piece elsewhere (ie. don't make the line), the stack height becomes high enough for the piece not to matter when making a line, because an L-piece won't surpass the rest of the stack. The game therefore does not give you a second L-piece, and I believe this is what originally happened.

In the second replay, two S-pieces are placed oddly. The game gives a third S-piece, even though it does not yield the highest peak. It can go on the far left, even with the rest of the S-pieces. What the game is supposed to give you is a Z-piece, as it (and I and J-pieces, but the priority is to Z-pieces) gives you a peak one higher than the rest of the stack. This is inconsistent with the previous algorithm, and potentially breaks some replays.

I also found a minor bug involving the replays. Play this: DAAA AAAA AAAE AAAA AAAA AAAA AADA BAAA CA8 (the shortest possible game, 69 inputs), and then observe the replay that the game gives you (and note it does not end in 8). The replay is one input short, and if you play it, the game won't end. Maybe this is because of an odd number of inputs, and the last character not being padded with a zero-input (which happens to be left, but the game is already over).

Feel free to ignore this if any of it is wrong, or I'm just imagining things. Thank you for reading this, and good luck on making a hard-mode of this game.

ps. I don't care who gets the credit for finding bugs, as long as they get fixed.

2010-05-03 19:31:03 by sone:

I want to play Internet Explorer.
Please add it here.

function inputKey(e) {

var transformId = null;
e = e || window.event; // add for IE
switch(e.keyCode) {


function startReplay() {

// user inputs replay string
var string = prompt() || ""; // change for IE

2010-05-03 21:13:13 by Sam:

I don't have Internet Explorer to test those fixes in, but I've confirmed the game still works in Firefox after those changes are made, so I'm uploading a new version with the changes added and good luck to you all.

2010-05-03 21:32:05 by Sam:

Guest: You're correct, I modified the algorithm to test for lines made rather than the height of the tower left over afterwards. This was closer to the spirit of "the hardest possible Tetris" but evidently it results in some slight changes to piece choice. If it's possible to get a line with every possible piece, then it may turn out that an S will sit relatively flush with the ground, while an L or a J will poke up in the air. If "number of lines" is the deciding factor, then an S will appear, since it's at the top of the list i.e. it's the least desirable piece for general purposes. If "height" is the deciding factor, then an L will be given instead since this is marginally less preferable.

In most other cases, of course, both algorithms will result in the same piece being generated.

I don't believe that there is any situation where it turns out that giving the user a line will result in a higher tower than any other possibility, so I will see what I can do about reverting this change.

2010-05-03 22:23:03 by Sam:

I believe the latest update of HATETRIS will fix the replay bug. Apologies for this oversight: because each hexadecimal character encodes not one but two keystrokes, there is a small issue which arises when a game takes only an odd number of keystrokes to complete.

2010-05-03 22:42:13 by hasi:

line 170:
> ints.push(hashCode(thisPiece.x, thisPiece.y, thisPiece.o));
Is this the intent?
I think this statement means ints[0] = hashCode

2010-05-03 23:25:03 by Sam:

Actually both of those lines would be functionally equivalent and wrong. It should have been "ints[hashCode()] = 1". Cheers

2010-05-04 01:36:24 by sone:

I was able to enjoy this game by Internet Explorer.
Thanks a lot!

2010-05-04 04:20:17 by masuidrive:

Thank you for cool game!
I made iPhone safari version Hatetris.
I add thin iPhone safari wrapper to your code.
Can I publish modified Hatetris to my blog?

2010-05-04 09:52:49 by Sam:

Um, no. The game works fine in Safari. iPhone users can just visit the site.

2010-05-04 10:33:55 by masuidrive:

Really? how do I move cursor?

2010-05-04 17:02:47 by SlashdotJP:

30 lines !
http://slashdot.jp/comments.pl?sid=493607&cid=1758529

2010-05-05 11:50:48 by archmond:

wow... funny ;)

2010-05-05 22:51:13 by T:

Keyboard does not repeat, making the "dropping" of pieces a bit tiresome...

Opera 9.64. Linux.

2010-05-06 00:54:22 by CS:

The iPhone and iPod Touch lack a keyboard which makes nearly impossible to play.
I have tried it on both Safari and Opera Mini on the iPod Touch.

2010-05-06 02:48:21 by T:

Ok, just tried writing a program for playing this.

I manage a search depth of 4-5 pieces (trying all rotations and placements of all pieces, using minimax with alpha beta pruning).

That is not good enough: it manages to eliminate only 4 rows.

Considering this was a 3h hack (from scratch) there might be several tunings left to do for achieving deeper search depths. Also my evaluation function can probably be tweaked some more, both regarding speed and evaluation quality. (I use 4096*eliminated_lines - sum_i column_height[i]^2 )

Another time.

//Tapani

2010-05-06 10:06:03 by Sam:

The fact that the keydown event doesn't repeat in Opera seems to be a known issue in Opera:

http://www.quirksmode.org/dom/events/index.html#t09

If anybody has the faintest idea how to resolve this I would very much like to know!

2010-05-06 12:52:12 by T:

Sam,

about keyboard repeat in Opera -- I found some link suggesting using the keypress event instead of keydown.
http://www.webdeveloper.com/forum/showthread.php?t=205426

I am not a web developer, so I don't know if that is helpful here. Maybe add a key (that generates an ascii code) for just dropping (e.g. space), since that is where repeating is the most useful?

//Tapani

2010-05-06 21:35:06 by Sam:

All of this is only increasing my irritation at the current state of JavaScript.

Opera's failure to repeat the onkeydown event when a key is held down is Opera's problem, not mine. However, "move to a different browser" always enrages me when proffered as a solution to any kind of browser issue, so I won't rehearse it myself, and instead hunt for an alternate solution. Onkeypress is blatantly the wrong solution because that isn't what the onkeypress event is for ('tis for entering data, not inputting control keys).

While I have verified that HATETRIS works in Safari it hadn't occurred to me that iPhones have nothing resembling a sensible keyboard and I don't own one myself so it took me a little while to find out that iPhone games are usually set up so that portions of the screen function like keyboard controls when tapped. With this in mind I've added four touch-sensitive areas at the top left of the playing field which can be used as controls if you do not have an actual keyboard to hand.

This solution has the same problem as the Opera problem, namely that holding down your finger on the button doesn't repeat the input, so to move the piece to the bottom means you have to hold the button down for a while. However, I'm hoping that there will be a harmonious solution to both problems whereby onkeydown starts a repeating loop of inputs and onkeyup halts that loop - the only remaining task is for me to think about it for a while and then implement it.

Continued...

2010-05-06 21:59:16 by Sam:

Ugh, I got someone to try the new controls on their iPhone and apparently the buttons are far too close together to be usable.

I can't easily enlarge the buttons since they're tied to the game grid. Evidently adapting this game for the iPhone is going to be much more complex than I imagined. Suddenly I understand that the iPhone is clearly a platform that hates developers and wants them to suffer and I've only been trying to develop for it for about two hours.

Make your own entertainment, I guess.

2010-05-07 06:54:00 by T:

Ok, I tried Firefox instead of Opera. It doesn't work there either. (linux, FF 3.0.10).

I googled a bit, and found for instance this thread about it:
http://stackoverflow.com/questions/1900117/how-can-i-get-auto-repeated-keydown-events-in-firefox-when-arrow-keys-are-held-do

Recommended workaround is ... to use keypress. =/

//Tapani

2010-05-07 18:19:30 by Luke:

It seems broken. If you follow the strategy from the 30 line high score, the S piece that makes your first line seems like not the most inconvenient shape. Wouldn't a backwards L piece be less useful at that point?

2010-05-07 18:46:44 by Sam:

Not according to the algorithm. Both a J and an S piece would give you a line at that point. All things being equal, then, the AI will give you an S rather than anything else. It would be possible to vary the piece which is supplied but I think this actually makes it easier.

2010-05-10 13:29:18 by bshnet:

D555 57AA AAAA AAA6 AAAA AAAA 8AAA AAAA AA02 AAAA AAAA 8C00 002A AAAA AAA9 5555 AAAA AAAA AAC0 000D DC00 003F FBAA AAA0 AAAA AA80 0002 AAAA A9AA B1AA AAAA AB03 6AAA AAAB 2AAA AAA5 555A AAAA AB6A AAAA A02A AAAA B400 0F76 1555 57CE AAAA AD4E AAAA ACC0 02AA AAAD CAAA AA56 AAAA A5AA AA01 AAAA B000 00AA AAAF 5AAA 80AA AA2A AA55 556A AA6A A805 4000 0AAA 9555 DC1D 6AAC 35D6 AA2A A002 AB55 5700 2AB5 556A

2010-05-10 14:14:44 by Sam:

why would you post a replay in which you got 0 lines

2010-05-19 03:23:13 by Steve:

Your replay function is broken, I got four lines, but when I put in the replay number, it came out as a complete fail. (The piece progression wasn't even logical and after it finished, the replay code was something completely different.)

2010-05-19 08:08:40 by Sam:

Would you care to post the replay in question?

2010-06-01 00:19:48 by Hobbes:

003A AAAA AAAA A300 0AAA AAAA 3000 0AAA AAA0 39AA AAAA AAB4 0AAA AAAA AEAA AAAA AA5D 5AAE AAAA AA77 6AAA AAAA B555 5AAA AAAA 99AA AAAA A4CB 9AAA AA95 51AA AAAA AA5A AAAA AA80 C6DA AAAA A3B6 AAAA A955 526A AAAA A840 2AAA AAA5 AAAA A30D DAAA AB2A 27DC 0000 0AAA AAAB 98AA AAB2 8AAA A720 0AAA AA0B 82AA CAAA 8A7A AA8A A6EA C2C0 A6C5 2A82 9A70 2AAA 7002 A9BA A6AA AAA5 E9DB 6AAA 971A AA75 DAAA AAAC 6AAA 5F26 AAA9 77C0 0015 AAAA DD56 AAAA 4C2A AA50 00AA AA6B C45A A57C 5AAA AABB A52A A975 AAA9 C0AA 700A A756 CAA9 8AA8 6D5A A756 A85A A0B6 A005 5400 BF7C AA
I got 8... Its ok. i guess.

2010-10-12 10:12:52 by bottleHeD:

I got 5 on my second run - replay of last game: C000 2AAA AAAA AAAB 01AA AAAA B1AA AAAA AAD6 AAAA AAAA AC00 0000 AAAA AAB0 0AAA AAAA AB02 AAAA AC2A AAAA AAB2 AAAA AAEA AAAA AAD5 5556 AAAA AAAA AAAB 5AAA AB75 556A AAAA AAA9 AAAA AAAF EAAA AA95 556A AAAA AAAA C02A AAAB 0AAA AAAA AAAA AAB0 2AAA AAB0 0000 0AAA AAB0 000A AAAB 0000 2AAA C000 0AAB 2AAA AA95 B035 556A AAAA ADAA AAAF 2AAA AB55 56AA AAAB 5555 AAAA A9AA AAB5 5556 AAAA A5EA AAD5 55AA AB5A AAB5 556A AD6A A2AA AA0A AAAA EAAA 0AA0 2AAD 5555 AAAD 6B1A A001 2AB0 A

2010-10-12 10:18:52 by bottleHeD:

Great, 7 now - C000 AAAA AAAA B000 2AAA AAAA C000 AAAA AAB0 002A AAAA AB00 00AA AB00 00AA AC00 02AA C2AA AAAA AAC0 6AAA AAAA B0AA AAAA C2AA AAAC 2AAA AB0A AAB0 AAEA AAAA AAAE AAAA AAAE AAAA AAEA AAAB AEAA ABAA ABAA 96EA AAAA AAB5 AAAA AAA9 D542 AAAA AAD6 AAAA AD6A AAAD 556A AAAA AAA7 56AA AAAA AD9A AAAC 0000 AAB0 AABA A96B AA97 556A AAAA A759 AAAA AC00 00AA 83AA BAAB 5AAA B55A AAA9 5AAA A6AA A031 AAA5 6AAA CAA9 AAA5 D5AA A000 02AA EA97 56AB 4056 A

2010-10-20 23:26:48 by dtanders:

I used to hate JavaScript, too, until I realized that it's not really a problem with the language but with the (stupidly inconsistent) browser implementations of it and (more so) the DOM, which is just horrible.

Try doing something with node.js. When you can evaluate JS without browser bugs it becomes a lot nicer.

Oh and as someone who has had to do some iToy development, I understand your pain.

2010-11-15 23:56:34 by trophymursky:

just curious, have you ever thought of instead of maximizing the height, maximizing the height for pieces you can't clear lines for, like its essentially minimizing the lines and then maximizing the height is a tiebreaker.

2011-02-04 09:55:21 by Rick:

Here's a bug, a line made close to the top is not cleared and the game ends because of that.

replay of last game: EEAA A02A AAAB EAAA AAA8 AAA9 AAA8 AA95 5AAA AAA0 8229 6AA5 6AAA A00A 95AA AAAA A80A 55AA AAAA AA0A A5A5 AAAB 5EA0 9956 B5AA AAAA A800 2AAA AAAD 5056 AAAA AA80 35AA 54CA AAA0 0AAA AAAA B54A AAAA 8DC0 AAAA AAB0 B26D 5556 AAAA AA2A 0AAA 8D4A AB5A AAAB 156A AAA8 02AA AA8C AAAB 5AA0 AAB5 A2AA 754A AA85 D56A A0BA A80C 2AAA 00EA AB2A A80A A955 6A05 AAAB 7DFF C002 A8AA 5EAA A556 B5AA

2011-02-04 11:06:20 by Sam:

You went above the red line, that means you died. That's deliberate. If you go above the red line, even for an instant, you're dead.

2011-02-07 10:11:55 by Rick:

Well if the line was removed (since it was filled) then I would not be above the red line...

2011-02-07 16:04:23 by Sam:

Too bad you died before that could happen!

2011-02-09 11:06:43 by Rick:

What I mean is, in normal tetris, that would not be a death as total height after clearing the line
would not be over the red line. I played SO many versions since the early 80's and this always worked.
Therefore, I still call it a bug :-)

Nonetheless, I really liked your idea of a bastard tetris :-)

Take care,
Rick

2011-03-29 20:25:44 by HydraBurrito:

Infinite loop possible.

Here is 50 lines:

A002 AAAA AAAA AAAA A2AA 826A AAAA AA88 9600 0C0A AAAA AAAA A815 556A AAB2 8302 AAAA AAC0 02AA AA02 CAAA AAAA C02A AAAA C22A AAAA AAC2 AAAA AAB2 AAAA AAAE AAAA AAB5 05AA AAAA A2AA AAAA AB6A AA36 A86A 8C9A AAA8 3AAA AAAC 0AAA AC15 555A AAAA AAAA AC02 AAA3 002A 0CAB 5556 CEAA AB75 AAAA A56A AAAA AA34 92AA 8CAA AAA0 CAAA AAC1 5C03 1AAA 971D 6AAA AA95 AAAA AAEA AAAA D75A AAA9 5AAA AAAB 2AAA AAB0 AAA8 32AA AA80 302A AAAC 02AA B02A A8CA AAC1 AAA5 6AAA AAAE AAAA 56AA AAAA 56AA AAA9 5AAA AAA5 56AA AAAC 0002 AAAA 032A AAC0 AAAB 0AAA B2AA AC00 AA9C AAAA 956A AAAA A955 AAAA A955 AAAA A955 AAAA AA95 550E 2AAA 00C2 AA03 2AAA B02A AAC2 AAAC AAAB AA95 AAAA A665 56AA AAA9 556A AAAA AA55 AAAA A55A AAAA AB00 002A AAB0 0AAB 00AA B02A AAB0 AAAA CAAA A56A AAAA A95A AAAA 9556 AAAA AAEA AA8C 02A8 32AA AC2A AACA AABA A95A AAAA 995A AAAA AA56 AAAA A56A AAAA 56AA AAAA 032A AAB0 2AAA B000 02AA B00A AB0A AABB 2AAA BAAA 56AA AAAB 02AA C2AA CAA6 56AA AAAA 56AA AAAA 5555 AAAA AA56 AAAA A95A AAAA AF56 AAAA B002 AAAA AC02 AAAC 00AB 02AA AC2A AACA AAB1 AAAA B4AA 95AA AAAA 56AA AAA6 56AA AAAA 56AA AAA9 5AAA AAAC 00AA B00A AAAB 00AA AAC0 AAB0 AAAA CAAA AEAA A56A AAAA A56A AAA9 5AAA AAA9 5AAA AAA5 A6AA AAA4 0CAA AB0A AAAB 2AAA A55A AAAA AA56 AAAA 95AA AAAA A953 0F6A AABA AAAB A

2011-03-29 21:25:19 by Sam:

Sorry folks, that was a bug. I accidentally uploaded a version of HATETRIS where the order of piece preference was S O I Z L J T when it should obviously have been S Z O I L J T. Well spotted though.

2011-04-20 02:21:32 by FinalOne:

I just tied the 30 lines guy!!! to see my code watch my youtube video of it first! http://www.youtube.com/watch?v=EIBqEUvvDi0

2011-04-20 09:23:43 by Sam:

Sorry, you get no points for memorising another player's replay.

2011-04-22 04:43:19 by wallawalla:

C000 2AAA AAAA AAB0 0AAA AAAC 02AA AAAA AAC2 AAAA AAAC 2AAA AAAA EAAA AAAA A95A AAAA AAAA 9D5A AAAA AAA5 AAAA AAA9 D6AA AAAA A9AA AAAA B5AA AAAA AA89 AAAA AAAA 9EAA AAAA AA2A AAAA ABAA AAAA AAD5 5540 1555 56AA AAAB 56AA AAAA 88AA AAAA AAE2 AAAA AA82 2AAA AAAA 802A AAAA AAAA AAAB 00AA AAAC 2AAA AAAC 02AA AAAA A8CA AAAA AC02 AAAA AB0A AAAA BAAA AAAB 00AA AAA7 1402 AAAB AAAA AAB5 AAAA AAA5 D6AA AAAA A700 2AAA B22A AA72 AAAA A9DA AAAA AA56 AAAA A9AA AAA9 56AA AAAA 2AAA A9AA AAAA 55AA AAAA 802A AAA0 AAAA 4AAA A96A AAAA 7D5A AAAA 96AA 8C0A AAAA C2AA 8C0A AA47 5707 5000 02AA 32AA BAAB 755A EAAA AAAA 5C02 9756 A56A 8A9A 0AAC 2

2012-04-22 10:25:04 by Robert:

Would you please add the piece chosen by the AI to the replay string so that the replay program doesn't even have to have an AI, let alone the same AI. NB: You don't need to add the size of the play area too as that's implicit in the moves made, but a run length encoding of the moves would be good.

This way either you or anyone could modify the AI and replays can still be shared.

You'd need to keep a copy of the present AI to translate the present recordings, but that's not really difficult.

Oh, and don't forget to leave space for unknown pieces, of course, the playback would have to use different coloured pacman squares or something, unless you included the piece shapes (non standard only?) in the recording too.

2012-04-22 10:31:32 by Sam:

Run-length encoding is a good idea, maybe for the next version of HATETRIS. But I can't include the piece ID in the replays, because then a player could very easily manually modify the replay string to provide easier pieces. I don't know what you mean by "unknown pieces", there are only seven possible pieces.

2012-04-22 12:26:50 by Robert:

Of course the user could manually change the string; but what would be the point, running it side by side with the current AI would immediately label them as either a dishonest cheater or running an old version, which one is proven by asking what version they're running. It's exactly the same with the current file, there's nothing to stop anyone creating any string they like, but compare it against the current AI and it all falls apart. The only difference is that you can change what "current" means with the new one.

The unknown pieces was in response to this "You can also put custom pieces in the list at the top, including pieces of more or fewer than 4 "bits" (components)". Again a different set of pieces potentially allows for an even more evil game; of course you have to decide if it's actually fair to have a different piece set. Perhaps only if the piece set is is some way 'easier' for the player.

2012-06-10 17:37:59 by Muzozavr:

This is evil and genius. Got 2 lines, and can't get anything more than that.

Maybe HATETRIS II is possible, but the current HATETRIS is amazing as a puzzle game. It doesn't even feel like Tetris anymore, it feels more like one of those multi-state maze puzzles.

Only one thing I'd like to see added is a little bit from the original Linux version of bastet (which I've seen on YouTube) which actually calculates the MOST desirable piece and then shows it to you in a "next block" area, but instead of "next block" it says "won't give you this one!". I thought that was funny.

HATETRIS is totally the least forgiving implementation of the "most useless pieces" idea I've ever seen. Thank you.

2012-06-19 18:41:42 by Muzozavr:

Personal best is now 8 lines. It's a set of loopable actions that allow you to keep making lines in the same way, even though it keeps getting higher and eventually you lose.

A88A AAAA AAA6 9AAA 8AAA 2A69 2AAA AAA9 999A A9D9 AAAE 2A65 9D9A AAAA 8A8A 8AAA AAB6 7AAA AAAA 2222 AAAA AAB5 99AA AAAA 2AAA AAAA 882D 6955 9AA8 6AAD AAAA AA22 AAAA AAA2 222A AAAA B6A6 AAAA AA55 D6AA AAB6 9AAA AA2A AAAA A222 AAAA A888 A2AA AAD9 99AA AAA7 6AAA A8AA AAAA 2A2A AAA8 888A AAAE 6666 AAAD A6AA A2AA AAA2 22AA AA2F A6AA 8888 8AAA D56A AAAD A6AA A8AA AA22 2AAA B55A AA79 AAA2 2222 AB55 AAA9 DAA8 AAAA 22AA 8882 AAD5 6AAD 6AA2 AA82 2AAF AA00 AAB5 5AA7 6A8A A02A B00F 7AA

Seems you need to approach this thing in a completely non-Tetris way. The order of operations really matters.

2012-08-14 11:20:15 by Robin:

Would be very nice if you could add the actual feature of tetris that you can see the next block coming up. That way you could really position your block strategically (would significantly add to the difficulty of the AI I guess

2012-11-05 14:38:09 by Muzozavr:

What's the point? It's HATETRIS. It hates you. It doesn't want you to plan things out.

If there's anything new I would want to see is a feature that is the complete OPPOSITE -- it shows you the best block and says "won't give you this one!" I've seen that in a few versions of Bastet and it gives you *some* information while staying hateful to the player and funny as hell.

Oh, and if the bug that forces Opera users to TAP the button every single time instead of just holding it like in Firefox... that'd be nice.

2013-01-16 03:57:24 by MK:

It doesn't know what block it's going to give you until you place your current block, making either of the preceeding suggestions impossible. Though, to tweak the latter idea, maybe it could be a "don't you wish you had this piece?" feature for your current round.

2013-12-01 04:58:32 by QuillMcGee:

Hmm, I can't actually find what number I have to change to increase the search depth. There's the searchDepth thing, but that isn't actually called anywhere. There's the thisSearchDepth, but I don't see where that's defined. Any help?

2014-02-04 05:08:12 by Quelthias:

I wonder if it is possible to invent an AI to play this game.
Think of it as a test for the least possible amount of points that can be generated.