The classical game Tetris is one of the most basic game you can make. In its original version, the game was displayed on a terminal.
In this tutorial we will model the game's structure using the command line for debugging. Then we can simply add real time graphics on top.
Finally, you should definitely have a look at Tetris Effect. It's one of the most beautiful piece of software art ever made.
For the implementation, have a look at the Tetris Guideline.
Pay attention to spawning rules (need a random number generator) and rotation rules.
The 7 pieces:
Pieces are choosen at random, with some special rules to avoid situations where some pieces (like the long bar) don't drop for a time. It's not a strict requirement.
The random number generator is xor shift defined as :
Also called well, the playfield is usually 10 width by 20 height.