4 ms·
Disclaimer: I'm a longtime Tetrisconcept.net member and thus a Tetris nerd. As pointed by Scaevolus, this isn't exploiting the PRNG per se but rather the algor
by PetitPrince 13y ago
Disclaimer: I'm a longtime Tetrisconcept.net member and thus a Tetris nerd.
As pointed by Scaevolus, this isn't exploiting the PRNG per se but rather the algorithm that distribute the piece, or in the Tetris jargon "the randomizer" (also "random generator").
The subject of the randomizer is such an interesting one to study.
Very early in the history of Tetris the developers have noticed that the distribution of similar piece was detrimental to the gameplay. Not because necessarily of the famous "get enough S and Z and then you automatically die" effect (that's frankly such an improbable event that you'd better try to do be struck four consecutive time be a lightning bolt), but because it often lead to the creation of a shitty stack.
So they implemented technical measure to correct that. IIRC, Nintendo's version of Tetris for NES and Gameboy were the first to do that (it's a direct detection of repetition: if PieceGenerated == lastPieceGenerated, then reroll for another piece).
Then as time went on, more elaborate system appeared
My favorite one is used in the TGM series [0] : it keeps memory of the 4 most recent pieces and denies their distribution if the next generated piece is in that history.
There one remarkable thing in its design is that is still distribute the piece if the "rolling of a dice" fails more than 4 times.
By doing that, they managed to have a randomizer that is both reliable (gives enough variety in the distribution of piece so to not be screwed) and unpredictible. It is a very good thing for such a single player focused game.
[0] famous in the internet
for the "TGM 3 Tetris Arika !!! Invisible Tetris" and the older "Tetris
Japan Finals" videos:
https://www.youtube.com/watch?v=jwC544Z37qo https://www.youtube.com/watch?v=jwC544Z37qo
https://www.youtube.com/watch?v=mT4TYKJuzx0 https://www.youtube.com/watch?v=mT4TYKJuzx0
The "7-bag" system that is assumed to be used in this article is a mandatory gameplay element for all modern official Tetris (meaning, as far as I know, you cannot release a game called “Tetris” if you don’t use it).
As sp332 pointed out, this randomizer uses a metaphoric “bag” throughout which you take all the 7 pieces that it contains. Once you’ve run out of piece, you put them all back in and you repeat the procedure.
It a simpler system to understand, but it has some flaws.
The main one is that depending how you connect the "seam" of the bags, you can get some unwanted repetitions (e.g finish Bag3 with a T piece and start Bag4 with a T piece as well). This phenomena is even amplified when variant of the 7-bag algorithm is used such as in (now deceased) Tetris Online Japan, where they have a 8 bag strategy or in the New Tetris ("new" here being 1999, and being the N64), where they use a 63 bag (that was actually wanted in order to build 4x4 golden square, which is the gimmick of that version).
One criticism is that it is 100% predictable: you will get any given piece in at least 14 pieces generated. Since the officiel Tetris nowadays seems to relies on multiplayer gameplay (see also: T-Spin and its offensive bonus), having a 100% predictable randomizer could be actually a strength by adding a layer of "fairness".
Further reading: there's an awesome thread [1] in Tetrisconcept.net that talk about randomizer theory. It's a old though, and some image link are dead. Fortunately, archive.org can help us restore them. Two highlights are: A comparison of different randomizer in term of predictability [2] and reverse engineering a randomizer [3] with a graph that gives the probability of having a given piece in exactly X piece [4] or in at least X piece [5].
[1] http://www.tetrisconcept.net/forum/showthread.html?t=512 http://www.tetrisconcept.net/forum/showthread.html?t=512
[2] http://www.tetrisconcept.net/forum/showpost.html?p=20173&postcount=32 http://www.tetrisconcept.net/forum/showpost.html?p=20173&...
[3] http://web.archive.org/web/20080326015200/http://www.tetrisconcept.com/forum/viewtopic.php?p=11682#11682 http://web.archive.org/web/20080326015200/http://www.tetrisc...
[4] http://web.archive.org/web/20080326015208/http://img249.imageshack.us/img249/6804/ncfdhx5.png http://web.archive.org/web/20080326015208/http://img249.imag...
[5] http://web.archive.org/web/20080326015209/http://img249.imageshack.us/img249/6149/tojfdyv0.png http://web.archive.org/web/20080326015209/http://img249.imag...