Tetris
Tetris is a puzzle computer game created by Alexey Pajitnov on June 6, 1984. It is probably one of the most famous and popular games in the entire world. It can be played on games consoles, mobile phones, and even graphing calculators.
Here are the rules of Tetris:
- There are seven pieces composed of four blocks. These pieces are called tetrominoes.
The tetrominoes have special names to make discussing them much easier. Starting from the light blue piece and going clockwise: J, Z, L, S, T, O, I
- Tetrominoes in a random sequence will be dropped into a board with a size of 10x20 blocks.
- The board is empty at start.
- The game will continue until a piece can no longer exit or enter a spawning area. The spawning area is typically located in the top and center of the board.
Theoretically the game could last forever, but this has been proven to be false. An article entitled How to Lose at Tetris proves that an alternating sequence of S and Z tetrominoes will inevitably cause the player to fail no matter the skill of the player. Although this will take perhaps trillions of years for a random number generator to produce 120 alternating S and Z tetorminoes, it will not last forever.
Here is the source code for Tetris from Qt.