Skip to content
/ Tetris Public

๐Ÿงฑ A classic puzzle engine re-imagined with Python. Featuring persistent SQLite3 scoring, dynamic piece loading from external configs, and robust OOP logic. Clean architecture for a retro favorite.

License

Notifications You must be signed in to change notification settings

SebaB29/Tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐ŸŽฎ Tetris Game

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.

๐Ÿ“ธ Demo

Tetris Gameplay Demo

๐Ÿ“ Table of Contents

๐Ÿ“ Description

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.

๐Ÿงฉ Key Features

  • 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.

๐Ÿงฑ Project Structure

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

๐Ÿ› ๏ธ Technologies

  • Python 3.x
  • SQLite3: For persistent score storage.
  • Gamelib: A thread-based rendering library.

๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites

  • Python 3.10 or higher.
  • SQLite3 (usually bundled with Python).

โš™๏ธ Installation

  1. Clone the repository:
    git clone git@github.com:SebaB29/Tetris.git
    cd Tetris
  2. Ensure resources are present: Make sure resources/piezas.txt is in the directory before running.

๐Ÿ’ก Usage

Launch the game by running:

python main.py

๐ŸŽฎ Controls

Key Action
Arrow Up Move Up
Arrow Down Move Down
Arrow Left Move Left
Arrow Right Move Right
P Pause / Resume

๐Ÿค Contributing

  1. Fork the project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

๐Ÿงฑ A classic puzzle engine re-imagined with Python. Featuring persistent SQLite3 scoring, dynamic piece loading from external configs, and robust OOP logic. Clean architecture for a retro favorite.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages