HomeMethodTetris 7-bag

Tetris 7-bag: the piece queue that makes droughts impossible

A generator described as random contains one hard guarantee: you will never wait more than 12 pieces for an I. That guarantee falls out of how the bag is built, and a loop can falsify it. The artefact is a published probability. The tool is arithmetic.

Independent guide. We did not decompile a Tetris build. We read the documented algorithm, rebuilt it, and measured it. Piece distribution in any specific game may differ — the harness is how you check.

Findings

From TetrisWiki's Random Generator, revision oldid=26147, retrieved 18 Oct 2026. The hedge in the source is kept.

ClaimSource wordingConfidenceWhat it does not prove
All seven pieces appear in every baga sequence of all seven tetrominoes (I, J, L, O, S, T, Z) "as if the pieces were drawn from a bag"High—
Bag is refilled after each seven"The resulting sequence … is added to the queue, and another bag is then generated"High—
5,040 possible orderings"There are 7!, or 5,040, permutations of seven elements"High—
Each ordering near-equally likely"it is believed that Tetris assigns a nearly equal probability" — the hedge is in the sourceMediumNot a measured property of any specific build
Max 12 pieces between one I and the next"a run of no more than 12 tetrominoes in between one I tetromino and the next"High—
Snake runs capped at 4"S and Z tetrominoes can only occur in runs of no more than 4"High—
Four consecutive snakes must alternateonly SZSZ and ZSZS occur, out of sixteen combinationsHigh—
P(next four are SZSZ or ZSZS) = 1/3087stated outrightHighThat your game's generator is this one
P(any three consecutive are all snakes) = 1/257stated outright, and checked belowHighSame caveat
Origin: bag of 63, not 7developed for The New Tetris, with all nine of each type in one bagHigh—
It is a Guideline featureused in Tetris-branded games that follow the Tetris GuidelineHigh—
A known exception existsthe first tetromino of the first bag in Tetris: The Grand Master Ace is always one of I, J, L, THighWhether other games apply the same restriction

Why 12

Worst case: an I is the first piece of one bag and the last piece of the next. After that first I come the other 6 pieces of its bag, then 6 pieces of the following bag before its I. Pieces between the two Is: 6 + 6 = 12. A uniform generator has no ceiling. The probability of a gap of length g is (6/7)^g, so a 12-piece drought is ordinary under flat random. The bag makes that tail impossible.

Bag vs flatSame sample size

Both generators are written from the two descriptions. If the bag column exceeds 12, the reading of the source is wrong.

50,000
press Run both

Published probability check. The source says 1/257 ≈ 0.389% for three consecutive snakes.

run above first

The rule, in pseudocode

bag = []
function next_piece():
    if bag is empty:
        bag = shuffled([I, J, L, O, S, T, Z])
    return pop_front(bag)

function next_piece_naive():
    return uniform_choice([I, J, L, O, S, T, Z])

Two properties a recording can check: the queue is self-limiting (a run of the same piece needs a new bag), and it is not memoryless. Knowing the last six pieces can name the seventh. A generator with that property is detectable from seven pieces, with no access to a binary.

Try it yourself

I have a recording of piece sequences from a game, one line per piece.
Do not guess which generator it uses. Determine from the data: whether
each window of seven contains all seven pieces, the longest gap between
any two I pieces, and the longest run of S/Z. Report the observed
numbers, then say which generator model they are consistent with and
which they rule out.

What we could not confirm. Which games ship this generator, the shuffle implementation (Fisher–Yates or something weaker), and whether the queue's preview count is the 5 shown in most Guideline titles. The 1/257 check estimates over overlapping triples, which is not the only reading of the published wording. If your number lands near 1/257 on one reading and not the other, that discrepancy is the finding.

Next

Sources: Random Generator, TetrisWiki, permanent revision oldid=26147, retrieved 18 Oct 2026. Both generators, the drought measurement and the snake-triple estimate are our own code. The 12-piece bound is arithmetic from "one of each per bag"; the source also states the bound directly.