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 >= 20 and npm >= 10.8 (for semantic-release)
- Poetry (dependency manager)
Installation
-
Clone the repository:
git clone https://github.com/unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact cd OrecchietTetris-artifact
-
Install Poetry if you don't have it yet:
pip install -r requirements.txt
-
Install the project's dependencies:
poetry install npm install
-
(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 inmodel/interfaces.py;ITetrisinherits fromSubjectso the observer contract is part of the interface itselfTetris(ITetris)— game orchestrator; fires observer events on every state changeTetrisGui(Observer)— reacts to game events viaupdate(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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file orecchiettetris-0.3.0.tar.gz.
File metadata
- Download URL: orecchiettetris-0.3.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
020e4bb2a8553f60a6d5c842f2e1ae961e607d187f2ccd4b0f1a804b88f3176e
|
|
| MD5 |
99b3136a0aa803a4a2c7e656b335be01
|
|
| BLAKE2b-256 |
15cd478831e56ff0e10e0fd6d0bd8d6691996f954fb8017a556e134295ce8413
|
Provenance
The following attestation bundles were made for orecchiettetris-0.3.0.tar.gz:
Publisher:
deploy.yml on unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orecchiettetris-0.3.0.tar.gz -
Subject digest:
020e4bb2a8553f60a6d5c842f2e1ae961e607d187f2ccd4b0f1a804b88f3176e - Sigstore transparency entry: 1077184082
- Sigstore integration time:
-
Permalink:
unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact@04a8547e07c581d46bb80021eea7161ab9189920 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/unibo-dtm-se-2425-OrecchietTetris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@04a8547e07c581d46bb80021eea7161ab9189920 -
Trigger Event:
push
-
Statement type:
File details
Details for the file orecchiettetris-0.3.0-py3-none-any.whl.
File metadata
- Download URL: orecchiettetris-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce96b3f2438d7bab907ddc92062deedba967b6ef66f94f8a70d3e00d9333cf7a
|
|
| MD5 |
8900e4973c9bf151cd86879961637aa6
|
|
| BLAKE2b-256 |
ed894b60c99057b0600a2a6747fbd75856a29398a9001fbcc95e368af4970626
|
Provenance
The following attestation bundles were made for orecchiettetris-0.3.0-py3-none-any.whl:
Publisher:
deploy.yml on unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orecchiettetris-0.3.0-py3-none-any.whl -
Subject digest:
ce96b3f2438d7bab907ddc92062deedba967b6ef66f94f8a70d3e00d9333cf7a - Sigstore transparency entry: 1077184106
- Sigstore integration time:
-
Permalink:
unibo-dtm-se-2425-OrecchietTetris/OrecchietTetris-artifact@04a8547e07c581d46bb80021eea7161ab9189920 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/unibo-dtm-se-2425-OrecchietTetris
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@04a8547e07c581d46bb80021eea7161ab9189920 -
Trigger Event:
push
-
Statement type: