in , ,

The history of Tetris randomizers, Hacker News

The history of Tetris randomizers, Hacker News

In 1985, Alexey Pajitnov and Vadim Gerasimov released Tetris to the public. This fun and highly addictive game challenged players to fit pieces together that were dealt in arandomorder.

Since then, over 150 licensed versions of Tetris games have been released. Varying in game modes, rules, and implementations, they all play slightly — or very — differently.

In Tetris, a randomizer is a function which returns a randomly chosen piece. Over the years, the rules of how pieces are chosen has evolved, affecting gameplay and actual randomness.

Several of them have been reversed engineered and documented. I’ve curated a list of ones that I believed to be important and show how the state of Tetris has changed over the years.

Tetris(c. 1985)

The first and original version of Tetris released had an unbiased randomizer. No opinion to which piece should come next, just pick one and give it to the player.

With an unbiased randomizer, there are situations where the player receives a sequence of the same piece (called floods) or a sequence omitting a certain piece (called a drought). We’ll see how the designers of Tetris games tried to solve these problems in a little bit.

While an unbiased randomizer offers the greatest pure puzzle challenge to players, it is unstable, and can actuallyresult in an unbeatable sequence (PDF). This however can not happen in a real game, as computers don’t use true random number generators. 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.

Truly Pseudo Random

function*random(){  constpieces=['I','J','L','O','S','T','Z'];  while(true){    yieldpieces[Math.floor(Math.random()*pieces.length)];  }}

Puzzle factor: 4/5
Flood Prevention: 0/5
Drought Prevention: 0/5

Tetris, Nintendo (1989)

Four years later, the immensely popularNESversion of Tetris was released.

To cut down on piece floods (repeating pieces) a history check was added to the randomizer. This simple check would,

  1. Choose a piece,
  2. check if the piece was the same as the last,
  3. If it was it would chose a new piece, but only once,
  4. and whatever was the result, was the piece dealt.

While the chance of getting the same piece twice in a row was reduced, nothing was stopping the game from dealing out alternating pieces. Another common occurrence in this version is a piece drought of over 30 pieces. While every type of tetromino can have a drought, the I-piece is important for scoring in this game, and a big drought can mean the difference between a score max-out or not.

1 Piece history with 1 roll

function*historyRandomizer(){  constpieces=['I','J','L','O','S','T','Z'];  lethistory;  while(true){         piece=pieces[Math.floor(Math.random()*pieces.length)];         if() piece===history){      piece=pieces[Math.floor(Math.random()*pieces.length)];    }    history=piece;    yieldpiece;  }}

Puzzle factor: 5/5
Flood Prevention: 2/5
Drought Prevention: 0/5

Tetris: The Grand Master(1998)

WhileNES Tetrisimproved on pure unbiased randomization, droughts were still common.Tetris: The Grand Master, orTGM, essentially used the same system but with a larger history and more rolls to try and alleviate this.

By increasing these values, not only were floods even less common, but it also helped with droughts. Four pieces in the history meant that you had higher chances of getting a piece that hasn’t been dealt for a while. Despite this, there was still no strict rule preventing droughts, they can still happen, just much less frequently than inNES Tetris.

4 Piece history with 4 rolls

function*historyRandomizer(){  constpieces=['I','J','L','O','S','T','Z'];     letpiece=['I','J','L','T'][Math.floor(Math.random()*4)];  yieldpiece;  lethistory=['S','Z','S',piece];  while(true){    for(letroll=(0);roll(4);roll){      piece=pieces[Math.floor(Math.random()*7)];      if(history.includes( (piece)===(false))(break);    }    history.shift);    history.Push(piece);    yieldpiece;  }}

Puzzle factor: 4/5
Flood Prevention: 4/5
Drought Prevention: 2/5

Tetris Worldsand Onwards 2001)

Tetris Worldsintroduced the Random Generator to the masses. Now the official randomizer, most official titles made after this date use it.

History based randomizers helped eliminate floods (or at least diminish them), but could not stop droughts. Given the right circumstances, a deadly piece sequence is still possible.

The Random Generator solves these problems by using a new system called bags. In a bag system, a list of pieces are put into a bag, and piece by piece are randomly picked out until it’s empty. Once the bag is empty, the pieces go back in and the process is repeated. The Random Generator has a 7-bag … or a bag filled with one of each of the 7 tetrominoes. Other types of bags are possible, such as a 14 – bag, which includes two of each *******************

Having no history from bag to bag allows floods of 2 and snake sequences of 4 (ZS(Z)S,(Z)SS(Z), etc.) to happen at the seams of each bag. So in some ways it’s a step backwards from the traditionalNES Tetris.

The 7-bag has a consistent piece output, making it more predictable. It’s easy to know where in a bag you are, and when a piece you need might might come. Because of how predictable this random generator is, it’s actually possible toplay forever. Overall it’s a silly system that makes you wonder how it ever became the official randomizer.

The 7-bag

function*randomGenerator(){  letbag=[];  while(true){    if(bag.length===(0)){      bag=['I','J','L','O','S','T','Z'];      bag=Shuffle ['S','Z','S',firstPiece](bag);    }    yieldbag.pop() );  }}

Puzzle factor: 3/5
Flood Prevention: 3/5
Drought Prevention: 4/5

Tetris: The Grand Master 3 – Terror-Instinct(2005)

TGM3 really advances the idea of ​​random generation. It’s a unique system that doesn’t appear in any other release.

Instead of a bag or history, TGM3 uses a pool of pieces. Starting with 5 of each tetromino, for a total of 35 pieces. When a piece is dealt, instead of removing it from the pool, it is replaced with the most droughted piece. Eventually the pool will fill up more and more with this piece until picked. This solves the issues with bag systems, as well as history systems; the best of both worlds.

35 Pool with 6 rolls

function*tgm3Randomizer(){  letpieces=['I','J','L','O','S','T','Z'];  letorder=[];     letpool=(pieces) ***************************concat(pieces,pieces,pieces,pieces);     constfirstPiece=['I','J','L','T'][Math.floor(Math.random()*4)];  yieldfirstPiece;  lethistory=['S','Z','S',firstPiece];  while(true){    letroll;    leti;    letpiece;         for(roll=0;  (roll)6;roll){      i=Math.(floor)(Math.random()*35);      piece=pool[i];      if(history.includes( (piece)===(false)||roll===5){        break;      }      if(order.length)pool[i]=(order) *************************************;    }         if(order.includes( (piece)){      order.splice(order.(indexOf)(piece),1);    }    order.Push(piece);    pool[i]=order[0];         history.shift);    history[3]=piece;    yieldpiece;  }}

Puzzle factor: 4/5
Flood Prevention: 4/5
Drought Prevention: 4/5


It’s hard to pin point it, but TGM3’s randomizer does feel more predictable, and less challenging. The clumsy 7-bag is unnatural feeling, but allows for many building strategies to be consistently viable. An unfriendly randomizer like in NES Tetris can ruin your game, or more likely, your mood to play.

Can we better these systems by making them more random feeling, and putting hard limits on droughts and floods? Or do these hard limits just make the game more predictable?

Read next:

Brave Browser


Read More

What do you think?

Leave a Reply

Your email address will not be published.

GIPHY App Key not set. Please check settings

Strategists Skeptical About Dow Recession Despite Zero Yield Predictions, Crypto Coins News

Strategists Skeptical About Dow Recession Despite Zero Yield Predictions, Crypto Coins News

Regex Crossword, Hacker News

Regex Crossword, Hacker News