Skip to main content

Tetris with Apulian elements - a Software Engineering project.

Project description

OrecchietTetris

An exact copy of the Tetris game, with Apulian elements. Built as a Software Engineering university project.

Features

  • Classic Tetris gameplay with all 7 standard tetrominoes (I, O, T, S, Z, J, L)
  • Tetromino rotation, hard drop, and shadow piece (ghost piece preview)
  • Hold slot — store the current piece and swap it back in at any time
  • Observer pattern architecture decoupling game logic from the GUI
  • Formal interfaces (ITetromino, IBoard, ITetris) for clean dependency inversion
  • Automated testing via GitHub Actions (Windows, macOS, Ubuntu)
  • Automatic releases to PyPI via semantic-release on pushes to master
  • Automatic dependency updates via Renovate

Requirements

  • Python >= 3.11
  • Node >= 25 and npm >= 11.11 (for semantic-release)
  • Poetry (dependency manager)

Installation

  1. Clone the repository:

    git clone https://github.com/unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact
    cd OrecchietTetris-artifact
    
  2. Install Poetry if you don't have it yet:

    pip install -r requirements.txt
    
  3. Install the project's dependencies:

    poetry install
    npm install
    
  4. (Optional) Install pre-commit hooks for commit-message linting:

    poetry run poe hooks
    

Usage

Run the game:

poetry run OrecchietTetris

or alternatively:

python -m OrecchietTetris

Development

Run tests

poetry run poe test

Run a single test file or test case:

poetry run pytest -v tests/model/test_tetromino.py
poetry run pytest -v tests/model/test_tetromino.py::test_rotations

Coverage

poetry run poe coverage

Lint & type check

poetry run poe flake8
poetry run poe mypy

Project structure

OrecchietTetris-artifact/
├── OrecchietTetris/
│   ├── model/
│   │   ├── interfaces.py       # ITetromino, IBoard, ITetris abstract interfaces
│   │   ├── tetromino.py        # ShapeType enum and Tetromino(ITetromino)
│   │   ├── board.py            # Board(IBoard) — fixed grid engine
│   │   └── tetris.py           # Tetris(Subject, ITetris) — game orchestrator
│   ├── gui/
│   │   └── TetrisGui.py        # GUI layer (Observer)
│   ├── utils/
│   │   └── observer_subject.py # Observer pattern base classes
│   ├── __init__.py
│   └── __main__.py
├── tests/
│   └── model/
│       └── test_tetromino.py
├── pyproject.toml
└── README.md

Architecture

The project uses the Observer pattern to decouple game logic from the view, with abstract interfaces for dependency inversion:

  • ITetromino, IBoard, ITetris — abstract interfaces defined in model/interfaces.py; ITetris inherits from Subject so the observer contract is part of the interface itself
  • Tetris(ITetris) — game orchestrator; fires observer events on every state change
  • TetrisGui(Observer) — reacts to game events via update(event_type, data)
  • Board(IBoard) — pure grid engine (collision detection, line clearing)
  • Tetromino(ITetromino) — falling piece with clockwise rotation

Observer events fired by Tetris

Event When Data
board_updated piece moved, rotated, or locked None
new_piece new piece spawned ITetromino
hold_updated hold slot changed ITetromino | None
lines_cleared lines removed int
score_updated score changed int
game_over spawn blocked None
paused / resumed pause toggled None

Releases

Releases are automated via GitHub Actions when pushing to master. Commit messages must follow the Conventional Commits specification for semantic-release to compute version numbers correctly (e.g. feat:, fix:, chore:).

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orecchiettetris-0.4.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orecchiettetris-0.4.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file orecchiettetris-0.4.0.tar.gz.

File metadata

  • Download URL: orecchiettetris-0.4.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for orecchiettetris-0.4.0.tar.gz
Algorithm Hash digest
SHA256 74db7e8debd26b4273f760f1abd4200c7be1af1f4b49df48a3b2ffe3a04bfb5f
MD5 29dbe87060918a8ee43fa48ae9184028
BLAKE2b-256 cd8428ca01f4b2a4cd46bb3dc4dc66fc2114f68d7cbc3d3c8e9243b129a019e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for orecchiettetris-0.4.0.tar.gz:

Publisher: deploy.yml on unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orecchiettetris-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for orecchiettetris-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09dc03169096cff5b35db1691e38cb38274ac3d34c102eac5e0042aabde0aa65
MD5 585fd6a278d28bdc03ab85f82f66be84
BLAKE2b-256 2c0c2fd7c4770954cb92e6ffae6de8611e03c82431af46c5ae41e93613377e17

See more details on using hashes here.

Provenance

The following attestation bundles were made for orecchiettetris-0.4.0-py3-none-any.whl:

Publisher: deploy.yml on unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page