Tetris is a classic puzzle video game where geometric shapes, known as "tetrominoes," fall from the top of a rectangular grid. The player must rotate and arrange these tetrominoes to form complete lines. Once a line is completed, it disappears, allowing more room for additional tetrominoes. The objective is to prevent the stack of blocks from reaching the top of the grid.
- Falling Tetrominoes: Shapes like I, O, T, S, Z, L, and J fall from the top.
- Line Clearing: Complete a row to clear it and earn points.
- Increasing Difficulty: As the game progresses, tetrominoes fall faster.
- Simple yet Challenging: Requires both strategy and reflexes.
Follow these steps to install and run a Tetris game created using Python.
Ensure you have Python installed on your system. You can download it from python.org.
First, clone the project repository from GitHub or download it as a ZIP file.
git clone https://github.com/MicheleGrieco/Tetris.git
cd Tetris
It's good practice to create a virtual environment to manage dependencies.
-
On macOS/Linux:
python3 -m venv venv source venv/bin/activate
-
On Windows:
python -m venv venv venv\Scripts\activate
Once in the project directory, install the required libraries using pip
.
pip install -r requirements.txt
If you don’t have a requirements.txt
file, make sure to install the necessary libraries, such as pygame
, manually:
pip install pygame
After installing the dependencies, run the game using the following command:
python main.py
When you are done playing or modifying the game, you can deactivate the virtual environment with:
deactivate