Closed dealingwith closed 3 years ago
This r/dailyprogrammer post states:
Contrary to popular belief, the tetromino pieces you are given in a game of Tetris are not randomly selected. Instead, all seven pieces are placed into a "bag." A piece is randomly removed from the bag and presented to the player until the bag is empty. When the bag is empty, it is refilled and the process is repeated for any additional pieces that are needed. In this way, it is assured that the player will never go too long without seeing a particular piece. It is possible for the player to receive two identical pieces in a row, but never three or more. Your task for today is to implement this system.
This seems like a good way to implement "Don't let the same tetromino spawn 2x in a row".
It'll also make implementing some sort of "Next n pieces" like on tetris.com/play-tetris: easier. (see "next" box to the right of the gameboard)