# let piece = ['I', 'J', 'L', 'T'][Math.floor(Math.random() * 4)];September 4, 2019 9:38 AM   Subscribe

That is amazingly cool and sort of surprising. The early gen randomizers were problematic -- see the floods and droughts -- but I enjoyed that kind of challenge. I haven't played newer versions.
posted by jeather at 10:17 AM on September 4, 2019

I like this analysis! Gonna ask a quibbling question about this assertion though: "Pseudo random number generators try to mimic real randomness, but don’t have the properties required to deal out 70,000 Z-pieces in a row." That's not true in general. But I wonder if the Tetris he's referring to was using a simple 16 bit random number generator? Because in that case the sequence will repeat itself after 65,535 pieces. Also a 16 bit generator in the naive implementation would have 65,535/7 = 9362 Z-pieces in it, in some ways it acts more like a giant pool.
posted by Nelson at 10:24 AM on September 4, 2019 [3 favorites]

For the completely opposite approach see Hatetris, which tries to pick the worst possible next tetromino given the state of the well. It often appears to be stuck on S pieces but it's not broken, just actively malicious.
posted by figurant at 10:29 AM on September 4, 2019 [8 favorites]

check if the piece was the same as the last,
...
if (piece !== history) {

That doesn't look right to me.
posted by Pig Tail Orchestra at 10:50 AM on September 4, 2019

I know the author doesn't seem fond of them, but the 7-bag randomizer (and a swap space) enables the current "versus tetris as fighting game with known openings and combos" meta, which I find fascinating. There's also standardization around wall kicks and T-spins which vary greatly across early games, I think.

(I'm not great at competitive tetris, but I've got a perfect clear opening memorized and it's great fun using it in split screen Puyo Puyo Tetris.)
posted by Anonymous Function at 10:59 AM on September 4, 2019 [2 favorites]

I checked out of Tetris after the original Gameboy, but making the selection less random has to make it considerably easier. The point to Tetris is that it hates you, it will destroy you, but only lightning-fast tactics will save you for a while. To turn it into a strategy game that you can memorize openings seems completely wrong.
posted by scruss at 11:19 AM on September 4, 2019

Anonymous Function: "the 7-bag randomizer (and a swap space) enables the current "versus tetris as fighting game with known openings and combos" meta, which I find fascinating."
You and me and some 3 million people on Tetris 99 alone. I feel that the 7-bag system is simple enough to keep in your head and plan around and just complex enough to allow for the creation of strategies. I'm sure not even the top Tetris players can consistently plan ahead with the 35-bag system, keeping that kind of buffer seems impossible without some kind of assistance or just playing with your next piece in mind (which is the most basic strategy anyways)
TGM3 uses a pool of pieces. Starting with 5 of each tetromino, for a total of 35 pieces. (...) This solves the issues with bag systems, as well as history systems; the best of both worlds.
This to me seems like the old Gamescience dice conundrum all over again. Yeah, it's possible to build a near-random number generator with atmospheric data and rigorous mathematics, but my Tetris and my RPGs need to be just random enough to be challenging and fun.
It's hard to pin point it, but TGM3’s randomizer does feel more predictable, and less challenging.
Maybe that's why it's not used anymore.
posted by andycyca at 11:27 AM on September 4, 2019

Pig Tail Orchestra: That doesn't look right to me.

Huh. It currently shows "==" instead of "!==". Maybe they fixed it in the interim?
posted by mhum at 11:46 AM on September 4, 2019 [1 favorite]

Very neat. And, heh, I don't know where or when but I've definitely read that How to lose at Tetris paper before.

I didn't know the 7-bag was a common thing (I'm pretty sure the Tetris I grew up on was a straight randomizer) but I totally see how having a simple and countable system like that would be a boon to a competitive scene. You're still navigating chance and luck but only over the short term, so it's more about keeping a count and playing for time dynamically than just hoping you don't get absolutely ruined by the RNG.

It's interesting to me that there's no examples of systems that do an abstract numeric weighting; that'd absolutely be my inclination if I were trying to throw something together from scratch, nudge the probabilities after each pick toward and away from p = 1/7 for each picked and unpicked piece respectively by some quantum or small exponent. Whether that would work nicely in practice is its own question, of course, and I think the one time I actually implemented Tetris myself (for my Palm IIIc of all things) I did use a straight unbiased randomizer. But it was a lousy machine to play Tetris on, so it's not like I got a chance to get sick of droughts.
posted by cortex at 12:10 PM on September 4, 2019

Heh cortex. I'd like to see something odd like...
shuffle the 7 pieces, then place them equally around a circle.
assign each a rotational velocity.
to pick a piece you use the sine of the piece's position to calculate the weight and do a random weighted pick.

This could be tuned by the range of the initial rotational velocities and perturbing them by some amount. And or picking a weight to apply to the sine values when waiting.

It's like giving each piece a biorhythm cycle where you could just change some initial parameters and take it from almost random to almost very likely that each piece gets picked in the same order.
posted by zengargoyle at 9:59 PM on September 4, 2019

To be clearer, the piece-choosing algorithm in HATETRIS is strictly deterministic, with no random component at all. Given the same well content, it will always pick the same piece. This has the consequence that in theory it may be possible to catch HATETRIS in a loop and score infinite points. It also means that the HATETRIS replay system only encodes keystrokes, not the pieces which appear, making it impossible to fabricate high-scoring replays.
posted by qntm at 4:42 AM on September 5, 2019 [1 favorite]

« Older "The status quo is unacceptable"   |   Venue turned down an interracial wedding, citing... Newer »