Random Generator: Difference between revisions

From TetrisWiki
Jump to navigation Jump to search
*>Tepples
(final integration from Tetris Guideline)
*>Nicholas
No edit summary
Line 17: Line 17:
*[http://www.tetrisconcept.com/forum/viewtopic.php?p=822#822 Randomizer discussion on forum]
*[http://www.tetrisconcept.com/forum/viewtopic.php?p=822#822 Randomizer discussion on forum]
**[http://www.tetrisconcept.com/forum/viewtopic.php?p=2030#2030 Name of Random Generator revealed]
**[http://www.tetrisconcept.com/forum/viewtopic.php?p=2030#2030 Name of Random Generator revealed]
== See also ==
*[[Blackjack]]

Revision as of 18:14, 4 January 2007

The Random Generator is BPS's name for the algorithm used to generate the sequence of tetrominoes in Tetris brand games that follow the Tetris Guideline.

Random Generator generates a sequence of all seven one-sided tetrominoes (I, J, L, O, S, T, Z) permuted randomly, as if they were drawn from a bag. Then it deals all seven tetrominoes to the piece sequence before generating another bag. There are 7!, or 5,040, permutations of seven elements, and it is believed that Tetris assigns a nearly equal probability to each of these, making it much less likely that the player will get an obscenely long run without a desired tetromino. It can produce a maximum of 12 tetrominoes between one I and the next I, and a run of S and Z tetrominoes is limited to a maximum of 4

Despite the generic sounding name, presumed employees of BPS are known to treat the term "Random Generator" as a unique name, referring only to this particular algorithm.

Snake sequences

There are two "snake" tetrominoes, called S and Z. As only two snakes will be in a given bag, a sequence of more than two snakes must cross the "seam" between bags. The probability of the next two bags having a sequence of four consecutive snakes, the maximum possible, is 1/(7*6*7*6) for SZSZ and likewise for SZZS, ZSSZ, and ZSZS, for a total of 1/441. But the probability of these being your three next pieces are 1/441 times the probability of being at position 6 in a bag, so the probability of the next four pieces being SZSZ are 1 in 3087.

Define a "2|1 combo" as chosen sixth and seventh pieces in one bag and first piece in next bag, and a "1|2 combo" as chosen seventh piece in one bag and first and second pieces in next bag. Define a "snake" as the S tetromino or the Z tetromino.

The probability of any 2|1 combo (e.g. SZ|Z) is 1/(7*6*7) = 1/294. There are four different 2|1 combos containing all snakes (SZ|Z, SZ|S, ZS|Z, and ZS|S), so the probability of getting a 3-snake 2|1 in your next two bags is 4/294. But the probability of being at the sixth piece in a bag, where your next three pieces are a 2|1, is 1/7, making the probability of being at a three-snake 2|1 equal to 4/(294*7) = 2/1029. By symmetry, the 1|2 probabilities are exactly the same: 2/1029. So for Random Generator, this makes a 1 in 257 chance of your next three tetrominoes being snakes.

To do: compare with odds for TGM randomizer

References

See also