If Charlie Brown Played Tetris, Would He Be a Block Head?
November 16, 2021 11:59 AM   Subscribe

There is, quite literally and no foolin', an end to Tetris. And this guy wrote an AI to find it (semi-long but somewhat soothing SLYT).
posted by MollyRealized (39 comments total)

This post was deleted for the following reason: Poster's Request -- loup



 
*Happy balalaika noises*
posted by leotrotsky at 12:24 PM on November 16, 2021 [4 favorites]


Blast from the past earwirm. Thanks.
posted by sudogeek at 12:28 PM on November 16, 2021 [1 favorite]


There's also a theoretical end to Tetris with high probability. A full analysis of how to handle any sequence of blocks, either if known in advance or if provided with limited lookahead, notes that a long sequence of alternating S and Z tetrominoes will eventually fill up the board, even if the player is omniscient and plays perfectly. Of course, such a long disastrous run of pieces is extremely unlikely, but in the infinite timeframe, every finite probability, no matter how unlikely, will eventually occur. So, assuming random selection of pieces, there is definitely a threshold (in number of pieces, score, lines, whatever metric you want to use) above which even a perfect player will, with very high probability, receive a sequence of pieces which cannot be placed without losing the game.

It's possible that the NES's pseudorandom number generator, because it is pseudorandom and has a limited capability to produce "new" numbers, however, can never actually reach a configuration where it generates such a sequence.
posted by jackbishop at 12:57 PM on November 16, 2021 [24 favorites]


Of course, such a long disastrous run of pieces is extremely unlikely, but in the infinite timeframe, every finite probability, no matter how unlikely, will eventually occur.

What if you give it a fresh cup of really hot tea?
posted by Insert Clever Name Here at 1:05 PM on November 16, 2021 [43 favorites]


I am really bad at Tetris so obviously I decided to make it harder for myself by inventing a game called Puzzle Tetris. It's pretty simple -- you intentionally place the first up to ten pieces so as to leave big gaps and blocked-off areas, then you try to clear the final line that had a gap in it, either from the placement of the initial pieces or created during the playing of the game. The number of pieces you drop initially is the "level" of Puzzle Tetris you're playing, so if you're feeling like a challenge you can go for Level 10 Puzzle Tetris but if you only feel like a leisurely game you can drop just four or five pieces disadvantageously and play Level 4 or 5 Puzzle Tetris (example: the initial board for a game of Level 10 Puzzle Tetris). Please note that it is not enough to clear all the gaps, you must also clear the final line that had a gap in it (I have lost because of this rule -- I got down to one line, got an unlucky piece, and lost, it was wild). Because it's Tetris the pieces speed up as you play so the longer it takes you to clear the board the harder it ends up being (and this is rough because I am, as I say, very bad at Tetris).

This has been an explanation of the game Puzzle Tetris and how to play it, thank you for your time.
posted by an octopus IRL at 1:21 PM on November 16, 2021 [14 favorites]


a long sequence of alternating S and Z tetrominoes can't occur in official Tetris since 2001. Modern Tetris hands out pieces from a bag of all 7 shapes permuted randomly, so at most you'll get four S and Z in a row before you get something else. But this video is a demo of NES Tetris which uses a simpler algorithm and I think it is theoretically possible you'd get a long enough streak of SZ in that version. (Tetris is remarkably subtle!)
posted by Nelson at 1:49 PM on November 16, 2021 [10 favorites]


The version of Tetris I played on the Commodore 64 did not seed the random number generator from the clock or the SID chip, so it always gave the same sequence of pieces the first time you run it after a reboot. I memorized the first several moves for the best possible result.
posted by Foosnark at 2:30 PM on November 16, 2021 [5 favorites]


Soothing and anxiety-inducing at the same time. I like it! The guy's admiration for his anthropomorphized computer program is particularly endearing.

Is stacking on the left and leaving space for long bars on the right a standard technique?
posted by Gerald Bostock at 2:55 PM on November 16, 2021 [5 favorites]


I am really bad at Tetris so obviously I decided to make it harder for myself by inventing a game called Puzzle Tetris. It's pretty simple -- you intentionally place the first up to ten pieces so as to leave big gaps and blocked-off areas, then you try to clear the final line that had a gap in it, either from the placement of the initial pieces or created during the playing of the game.

This (but without speedup and with the objective being to clear 25 lines) is actually one of the two playable modes in NES Tetris; it's called "B-Type."
posted by fifthrider at 3:15 PM on November 16, 2021 [4 favorites]


I think it is theoretically possible you'd get a long enough streak of SZ in that version. (Tetris is remarkably subtle!)

NES tetris uses a 16 bit PRNG with a period of 32767 , but the PRNG advances at least once every frame, so probably any arbitrary sequence of pieces could be produced by a player with frame-perfect timing.
posted by Pyry at 4:25 PM on November 16, 2021 [5 favorites]


I made a Tetris playing program once.

In college, we had a login server running some linux or another. I found it had tetris-bsd installed, among other text-based command line games. Some games like Tetris had high score boards shared systemwide, so you could compete against other users. At first, I had all the high scores, because no one else was playing the games. But I told some people about the games. Including Geoff. And Geoff was better at Tetris than I was. And I thought he was a bit of a jerk about that (or... maybe I was just a bit of a sore loser about it).

The next summer, I was working as a software developer at a place that didn't have enough work for me. I filled my time with various things, including developing a program to play Tetris. It would take control of the program, read the display to see what blocks showed up, and send keystrokes to control the placement. It would drop blocks almost instantly, and this meant it would be placing several per second. It was neat to watch it play so fast.

I did all of this in Perl. Don't do this in Perl.

So it was pretty good, but there were some parameters that I could tweak to change the decisions it made and thus how well it played. The company I was working for also had a linux server that was doing about as much work as I was (not much), so I used that to run a search of the space of parameters and optimize them. I ran that overnight. Or maybe for several days. I got some good parameters.

So then I had a program that played Tetris really well. Superhumanly well. I could have taken back the high scores from Geoff at any moment. But I didn't.

I also had a website on this same login server. This was the "under construction GIF" era of the internet. I put random things there. It was running PHP, so I could make things like a page that anyone could post a comment to. Some kids from my high school found it and posted something rude and vaguely mean (to me). Yes, I invented Twitter.

Anyway, I put a script in the main page of my website that would trigger any time anyone visited the page. Each time someone visited, the script ran my Tetris program and played one game.

One day, Geoff logged in to the server, checked the Tetris high scores, and saw that a user named wwwuser had beat his high score. The web server... had utterly crushed his score.

I heard that when Geoff learned this he was upset. When I learned that, I smiled.
posted by whatnotever at 4:30 PM on November 16, 2021 [40 favorites]


I am just amazed at how robustly the game plays despite hitting limits well beyond what the developers ever expected. The scoreboard and colors degrade, but the game will not crash until you reach an absolutely ludicrous number of lines. I'm very impressed by this.
posted by rouftop at 4:40 PM on November 16, 2021 [3 favorites]


Is stacking on the left and leaving space for long bars on the right a standard technique?

Yes. In most (all?) versions of Tetris, you receive a lot more points for completing four lines at one time using an "I" piece so play is optimized to leave a "well," a space for those pieces to fit into. Leaving a well on the right side would be a "right well." I don't know if there are any advantages to using a right well over a left well; there probably isn't for most players but things are different at the very highest levels of play especially when you get into very difficult ways of making very, very fast moves.

(If you can't tell, I have enjoyed watching some competitive Tetris and some explanatory videos. Except for the esoteric movement strategies that are used by the very, very best players, it's all very comprehensible. It's incredibly fun to watch high-level Tetris because it's understandable.)
posted by ElKevbo at 4:46 PM on November 16, 2021 [2 favorites]


I would just like to share the strange, droning music from the official c64 Tetris at this point in time. It is nothing like what every other Tetris' music has trained you to expect; instead of a cheerful remix of Russian folk music, it is a twenty-five minute piece that quietly emerges from the lonely darkness of interstellar space, grows in complexity, then fades away. It is music for stacking bricks at the end of time, when all is lost and done.

It is unique among c64 music in that it is has a music routine that uses a glitch in the SID chip to play low-res samples alongside the normal three synth voices, but unlike every other tune that does this, it does not roll up and immediately go "hey check out my samples" by opening with a voice saying "hey! hey! g-g-go! hey! hey!". No. Wally Beben was so confident in the strength of his tune that he doesn't break out the staticky, overdriven guitar drone until three minutes in.
posted by egypturnash at 4:48 PM on November 16, 2021 [38 favorites]


I wish someone would do this for Yars's Revenge. I'm pretty sure that I beat it, in that it refused to generate another level, and made the sounds of killing the player during the transitional screen. But I was 6 and it was once, never to be repeated. And nowhere online have I found anyone posting about the game being broken or beaten.
posted by bootlegpop at 4:50 PM on November 16, 2021 [3 favorites]


I don't know if there are any advantages to using a right well over a left well; there probably isn't for most players but things are different at the very highest levels of play especially when you get into very difficult ways of making very, very fast moves.

I'm not sure if this dictates the decision, but my understanding is that when you rotate a block in NES Tetris it biases to the right, so getting a vertical "I" block to the far right takes one less button press / DAS tick.
posted by fifthrider at 5:17 PM on November 16, 2021 [5 favorites]


I'm pretty good at NES Tetris--not world-class, but far better than anyone I've ever met. I found it interesting that I was making the same decisions as the AI about 80% of the time; there were a couple of basic strategies that were different, but I really noticed that the AI was far less concerned with choosing strategies that required frame-perfect rotation and placement than I am.

Mistakes in actually placing pieces end far more of my games than errors in deciding where to place them.
posted by Ickster at 5:53 PM on November 16, 2021 [4 favorites]


I remain endlessly impressed by the skill & cunning of the programmers who wrote these games using very limited CPU and memory resources and how they remain relatively well behaved long after they are pushed beyond whatever 'Oh, that will never happen so we don't need to worry about it' type boundary conditions.
posted by Insert Clever Name Here at 5:54 PM on November 16, 2021 [4 favorites]


I would just like to share the strange, droning music from the official c64 Tetris at this point in time. It is nothing like what every other Tetris' music has trained you to expect; instead of a cheerful remix of Russian folk music, it is a twenty-five minute piece that quietly emerges from the lonely darkness of interstellar space, grows in complexity, then fades away. It is music for stacking bricks at the end of time, when all is lost and done.


This is great! Kind of like Super Metroid vibes.

On the OP, love the glitched colour schemes, and some of the nicknames (lol "Mexico according to Hollywood").
posted by rodlymight at 6:00 PM on November 16, 2021 [2 favorites]


It was always an interesting challenge to see just how far you could get past the speed up screen. I clearly played way too much Tetris as a child
posted by Jacen at 6:26 PM on November 16, 2021


I wish someone would do this for Yars's Revenge. I'm pretty sure that I beat it, in that it refused to generate another level, and made the sounds of killing the player during the transitional screen. But I was 6 and it was once, never to be repeated. And nowhere online have I found anyone posting about the game being broken or beaten.


There is a fairly-easy-to-replicate kill screen on Yars' Revenge, as it happens. If you destroy the Qotile boss, and then remain directly on top of the thin line that appears on the static celebration screen that follows, the game displays an easter egg (the creator's initials, forwards and backwards) and abruptly quits.
posted by delfin at 6:44 PM on November 16, 2021 [5 favorites]


The glitched color schemes are surprisingly attractive.
posted by equalpants at 7:11 PM on November 16, 2021 [5 favorites]


On this subject, I do enjoy reading contemporary reviews of tetris that thought it would not have lasting appeal - Commodore User is the most egregious one I can recall. 5/10, no lasting appeal. Yeah, obviously called it there!
posted by jaymzjulian at 8:09 PM on November 16, 2021 [5 favorites]


I wonder why the game is subject to crashing sometime after level 240 or whatever. Is it a buffer overrun for one of the many counters in the game, or does the color locating code ping a sensitive bit at the wrong time, or what?

I watched this thing through to the end, and it was fascinating. I'm entirely glad he didn't try to narrate an entire hour-plus of the game in real time. This is maybe the best his AI has done (?) because he's obviously watched it many times, to know the change points and the color patterns and etc. This was NOT a casually-created video.

As someone who played enough Tetris "back in the day" to get the blocks under my eyelids while trying to sleep at night, and who has excellent station wagon cargo packing skills I refer to as "tetris skills"... This was a great watch. Thanks for posting!
posted by hippybear at 9:09 PM on November 16, 2021


It sounded like the crash had to do with the score math - the NES has an 8-bit processor, so needs to do more elaborate things to compute a score that's significantly higher than 255. The score gained scales with the level, and so if it does multiplication by means of repeated addition, reaching a level ten times higher than the game ever expects you to get might end up taxing it considerably - and if that calculation ends up taking longer than the game budgets for a single frame, a crash could come from it being interrupted by "hey time to draw the next frame now" when it's in the middle of doing math.
posted by NMcCoy at 9:33 PM on November 16, 2021 [6 favorites]


I discovered this video a couple of weeks ago and what really blew my mind was discovering that there are now human players have developed that new way of holding and rocking an NES controller to achieve controller inputs in - if I am recalling correctly - the 20hz range or more.

20+ button presses per second!? Really!? Whaaaaaaat the fuck?

I was a pretty good Tetris player on almost every version I've ever played but I will never, ever be that good.
posted by loquacious at 10:24 AM on November 17, 2021 [3 favorites]


I love this. Thank you. Level 237!

His excitement at 2:28: "Oh, that was so sneaky!"
posted by mrgrimm at 10:43 AM on November 17, 2021


20+ button presses per second!? Really!? Whaaaaaaat the fuck?

Playing a low, low, low E on the controller.
posted by atoxyl at 11:57 AM on November 17, 2021 [5 favorites]


I once got paid $600 an hour to play Tetris. I went in a for usability test for testing the UI of a code editor and debugger. The sample code I had to debug was a Tetris game that had some intentional bugs introduced into it. The (non-restricted) product they gave me as the gratuity for the test I already had, so I sold it on Ebay. I spent part of that two hours playing the game to make sure my bug fixes actually worked.
posted by Xoc at 12:00 PM on November 17, 2021 [3 favorites]


So, not really an “end.” I was really hoping for some kind of never-before-seen-by-human-eyes WINNER!!! screen. Nuts.

Also, kind of surprised there wasn’t an all-black-pieces level, once the game started the bug levels. Or, did I miss it?
posted by Thorzdad at 12:02 PM on November 17, 2021


Also, kind of surprised there wasn’t an all-black-pieces level, once the game started the bug levels. Or, did I miss it?

Calm down, Satan!
posted by loquacious at 12:43 PM on November 17, 2021


>What if you give it a fresh cup of really hot tea?
>posted by Insert Clever Name Here at 4:05 PM on November 16 [42 favorites +] [!] 
Nice.
posted by CaseyB at 12:46 PM on November 17, 2021 [5 favorites]


the PRNG advances at least once every frame, so probably any arbitrary sequence of pieces could be produced by a player with frame-perfect timing.

Or, conversely, the "bad" sequences could be avoided with frame-perfect timing?

I wounder if that's what's next for this AI? Add in some timing exploits to get unusually good pieces? (That's IIRC how that Arkanoid AI shaved time off its speedrun, by using RNG timing tweaks and paddle position to optimize the powerups dropping out of blocks.)
posted by jackbishop at 1:11 PM on November 17, 2021


I love this guy's enthusiasm for his amazing project, but this was not soothing at all, it was massively stressful!
posted by turbid dahlia at 2:42 PM on November 17, 2021


CaseyB: I was going to favorite it, but it felt like ruining it?
posted by Pronoiac at 2:42 PM on November 17, 2021 [2 favorites]


Proniac: same
posted by sy at 2:58 PM on November 17, 2021 [2 favorites]


Also same
posted by JHarris at 6:22 PM on November 17, 2021


Ickster's was the first favorite, not the latest; someone could remove their favorite though?

I think the YouTube neutral video was done by people reacting.
posted by Pronoiac at 12:33 PM on November 18, 2021


It's over. It was fun while it lasted, but it's best not to play silly number games that literally any member not realizing the joke could spoil.
posted by JHarris at 1:54 PM on November 19, 2021


« Older Why so many people undercharge for their work   |   Nominees for the Goodreads Choice Awards 2021 Newer »


This thread has been archived and is closed to new comments