120 points · by Impossible · 7y ago · 41 comments
https://tetrisconcept.net/threads/randomizer-theory.512/page...
Do you have a direct description of the algorithm? Extracting it from those forum posts seems a bit difficult.
To repeat it here: we assign each piece a piece a vector of 3 bits; thinking of these vectors as numbers from 0 to 7 (or rather 0 to 6, since 111 is unused), the pieces go in the order (L, J, I, O, Z, S, T).
Note that this assignment is not left-right symmetric; there's no particular relation between a piece and its mirror image. Like, L is 000, but J is 001; and Z is 100, but S is 101. That seems like kind of a dumb mistake -- it would've been easy enough to maintain symmetry. (As just one example among the 24 possible ways (assuming 111 must be kept unused), one could have used instead (O,J,I,Z,L,T,S).)
Anyway, each turn you pick one of these at random, and you look at the last two pieces; let's call these previous_1 and previous_2.
If -- considering pieces as their sets of 1-bits -- we have both that previous_1 is a subset of previous_2, and that the picked piece is a subset of previous_2 -- we reroll. After the third try we just take the piece no matter what.
Note that this means that there are some weird interactions between the previous two pieces. Like, if previous_1 is not a subset of previous_2, then we won't reroll no matter what piece we picked, so the new piece will be totally random. But if it is, then we may or may not reroll.
Definitely pretty weird. Have to wonder how on earth this was thought up...
This may all seem academic, and it is very important for the type of high speed games tgm is, but it really is the biggest thing I miss playing modern tetris games. Barring other gimmicks, you build and plan the exact same way in every modern tetris game. With the ever present hold mechanic to switch out a piece, you don't even need multiple piece previews that some new games give you. Consider, after playing 3 pieces, you know with certainty the next 4. With the hold plus 1 piece preview, you spend over half your time in the second half of the bag knowing the next three pieces.
"When a piece is spawned, the type of piece is selected using the following algorithm: pieceIndex = 1 + (randomInteger % 7); // 1..7 Because there is a constant p (= 1/7) chance of selecting a specific kind of piece, and all pieces of the same type are indistinguishable, the probability of having exactly k pieces of a specific type after n trials follows a Binomial distribution"
However, the standard isn't adopted by all. A competing set of guidelines says that the tetrominoes should be generated using the bag of 7 system described in the article. https://tetris.wiki/Tetris_Guideline
The reason is quite simple, it is absolutely impossible to hit a drought. The maximum number of same pieces you can get in a row is two (unless you count holding a piece) and at worst if you're waiting for a piece is that you might get 12 pieces inbetween. This makes the game quite a bit more predictable and more beginner friendly which is what TTC is going for apparently.
In say, classic Tetris (NES) it wasn't uncommon of having a drought for over 20 pieces if not even more.
The 7 in a bag enables a lot of different kinds of builds (like All-clears or the Albatross Special and its' variations) which suit PVP Tetris games like Tetris 99 quite well but it's kinda boring when you're playing solo against the game.
I personally enjoy the randomizer in Tetris the Absolute: The Grandmaster 2 PLUS (TAP+) and Tetris the Grandmaster 3 Terror Instinct (TGM Ti) because it definitely had an element of surprise without screwing you totally over.
I've never actually done the math, but it would be interesting to calculate the success rates of different build strategies in the 7 in a bag games. Anyways, I'm rambling on. Tetris just always warms my heart :)
Not necessarily beginner friendly, but more importantly... competitive friendly. Since there's a high amount of determinism between bags, Tetris is a great competitive game.
As such, Tetris can be played in an arcade setting without worrying about "bad luck" messing with one player or the other. This has led to the development of many good multiplayer Tetris games, such as Tetris Friends, Tetris Ultimate, Puyo Puyo Tetris, and Tetris 99.
I believe the order of balls is the same for both players in bust-a-move, but still the boards will quickly diverge a lot.
const pieces = ['I', 'J', 'L', 'O', 'S', 'T', 'Z'];
byte[] probs = [32, 32, 32, 32, 32, 32, 32];
piece getRandPiece(){
int v = Math.random(pieces.length * 32)
int sum = 0;
int r = 0;
for(int x = 0; x < pieces.length; x++){
sum += probs[x];
// check if random value with range
if(v < sum){
probs[x] -= pieces.length + 1;
r = x;
}
// increase the probability of each piece being selected
++probs[x];
}
return pieces[r];
}
I think the benefits would be:* Unlikely flood and drought
* Completes in a predictable time (will always loop for each piece)
* One random number requested (can be surprisingly expensive if on a slow processor or excessive numbers of calls are made)
Are there any negatives to this approach?
I actually like the bag one, knowing where in a bag you are gives an edge, and thus it adds an extra dimension to the game I feel.
>> The clumsy 7-bag is unnatural feeling, but allows for many building strategies to be consistently viable.
And consistency is one very important component of multiplayer games.
However for solo play where you end up playing at 20G, the seam problem (repeat of SZSZ) can wreck your game if it happens when you have an unfavorable shape of the stack and/or if you get caught up by the lock delay.
for the non-initiated: the piece spawns directly on the stack, on you have only a short time to react and place you pieceIt is only possible to play 20G if you have what is called TLS (Temporary Landing System) and IRS (Initial Rotating System) in TGM games. This means that even before your piece spawns and falls, you can rotate it by one rotation either clockwise or anticlockwise and when the piece drops, it doesn't lock into its' place immediately, you can move it for a short while.
Also, if the piece drops vertically, the locking time resets which means that you should build a pyramid shaped stack so that you can slide your pieces down on either side and rotate it where you want it before it locks.
No need for unnecessary complications - the pice becomes less numerous and less likely to come when there was a flood, and more common and more likely to come when there was a drought. You can even add a set aften less than seven pieces, to increase randomness (and thus difficulty) over time.
Playing infinitely in Tetris means repeating a pattern over and over again. I would suspect that transforming Tetris so that it is universally infinitely playable (probably by somehow erasing the fact that an infinite SZSZ is a death sequence) would lead to a game where the optimal play is also to repeat a pattern over and over game.
It would be indeed a game of skill but would rob the player out of all creativity and agency. Not a very fun game at the end.
But I think that proving that such game is infinitely playable is a hard (np hard ?) problem.
Not necessarily - you could define an infinitely long non-repeating sequence (although it will have arbitrarily long repeating sequences inside it) which would still not contain any certain-death sequences.
No need for unnecessary complications - the pice becomes less numerous and less likely to come when there was a flood, and more common and more likely to come when there was a drought. You can even add a set after less than seven pieces, to increase randomness (and thus difficulty) over time.
Reminds me of a similar result in which "locally noisy" bots inserted into human coordination games can yield a positive outcome!
Citation?