Description
This is a Tetris game written in Python, with a simple built-in AI that can play by itself. You run tetris_game.py from the command line to start a game or to watch the AI play. The project is split into three files: tetris_game.py for the main window and game loop, tetris_model.py for the data model of the board and pieces, and tetris_ai.py for the automatic player. The game uses PyQt5 for the window and NumPy for the board data, so both need to be installed first. The controls are the arrow keys to rotate, move left and move right, space to drop the current piece immediately, and P to pause. A panel on the right shows the next piece. The README explains how to switch between watching the AI and playing by hand by changing one line in tetris_game.py, and it notes that the default speed may be too fast for a person, so the Tetris.speed value can be lowered. The rules follow classic Tetris. The code is public on GitHub.…
Highlights
- Classic Tetris rules with a next-piece preview
- Built-in AI that plays automatically
- Keyboard controls including pause and hard drop
- Adjustable game speed
- Python with PyQt5 and NumPy
Ratings & Reviews
No ratings yet
Be the first to rate Tetris Game.
People also visit
Tetris Game FAQ
What is this project?
It is a Python version of the Tetris puzzle game, with an AI that can play it on its own, so you can either play or watch.
What do I need to run it?
Python 3, PyQt5 and NumPy. The README says to start the game by running tetris_game.py from a terminal.
How do I play it myself?
Uncomment one line in tetris_game.py and comment out the line that starts the AI, as the README describes. The game is then controlled from the keyboard.
How do I change the speed?
Change the speed value of the Tetris class in the source. The README notes the default may be too fast for a human player.
Is it free?
Yes. The code is public on GitHub and there is no price.
What are the best Tetris Game alternatives?
Popular alternatives to Tetris Game include TetrisBench, AI Gallery and Snake. See all Tetris Game alternatives



