Welcome to Tetris, a classic puzzle game implementation in Python. Arrange falling blocks (Tetrominoes) to clear lines, score points, and save your high scores in a local database. This project focuses on Object-Oriented Programming (OOP) and persistent data management.
This project is a university assignment designed to master complex game logic and data persistence. It features a custom graphical interface and a backend system to manage player scores using SQLite.
- Classic Mechanics: Line clearing, block rotation, and increasing difficulty.
- Persistent Scoring: High scores are saved locally using an SQLite3 database.
- Customizable Pieces: Tetromino shapes are loaded from an external configuration file (
piezas.txt). - Game State Management: Includes pause, game over, and real-time score tracking.
Tetris/
โโโ graphics/ # UI rendering and Gamelib integration
โโโ img/ # Demo GIF and screenshots
โโโ resources/ # Piece definitions (piezas.txt)
โโโ src/ # Core logic
โ โโโ tablero.py # Grid logic
โ โโโ pieza.py # Tetromino behavior
โ โโโ sistema_puntaje.py # SQL database management
โ โโโ tetris.py # Main game engine
โโโ main.py # Entry point
- Python 3.x
- SQLite3: For persistent score storage.
- Gamelib: A thread-based rendering library.
- Python 3.10 or higher.
- SQLite3 (usually bundled with Python).
- Clone the repository:
git clone git@github.com:SebaB29/Tetris.git cd Tetris - Ensure resources are present: Make sure resources/piezas.txt is in the directory before running.
Launch the game by running:
python main.py| Key | Action |
|---|---|
| Arrow Up | Move Up |
| Arrow Down | Move Down |
| Arrow Left | Move Left |
| Arrow Right | Move Right |
| P | Pause / Resume |
- Fork the project.
- Create your Feature Branch (git checkout -b feature/AmazingFeature).
- Commit your changes (git commit -m 'Add some AmazingFeature').
- Push to the Branch (git push origin feature/AmazingFeature).
- Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
