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
- Kivy-based GUI with Italian / English language switching
- Observer pattern architecture decoupling game logic from the view
- Formal interfaces (
ITetromino,IBoard,ITetris,IView) 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
- Kivy >= 2.3 (installed automatically by Poetry)
- Node >= 25 and npm >= 11.11 (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/
│ │ │ ├── itetromino.py # ITetromino abstract interface
│ │ │ ├── iboard.py # IBoard abstract interface
│ │ │ └── itetris.py # ITetris(Subject) abstract interface
│ │ ├── tetromino.py # ShapeType enum and Tetromino(ITetromino)
│ │ ├── board.py # Board(IBoard) — stub
│ │ └── tetris.py # Tetris(ITetris) — stub
│ ├── view/
│ │ ├── interfaces/
│ │ │ └── i_view.py # IView(Observer) abstract interface
│ │ ├── i18n.py # I18n — EN/IT runtime localization
│ │ ├── block_renderer.py # BlockRenderer — int → RGBA / Image
│ │ ├── menu_screen.py # MenuScreen(IView) — Kivy main menu
│ │ ├── game_screen.py # GameScreen(IView) — Kivy game board
│ │ └── app.py # TetrisApp(App) — Kivy entry point
│ ├── gui/
│ │ └── TetrisGui.py # Legacy stub (Observer)
│ ├── utils/
│ │ └── observer_subject.py # Subject, Observer, EventType
│ ├── __init__.py
│ └── __main__.py
├── tests/
│ ├── model/
│ │ └── test_tetromino.py
│ └── view/
│ ├── test_i18n.py
│ ├── test_block_renderer.py
│ └── test_i_view.py
├── assets/
│ └── blocks/ # I.png … L.png (block textures)
├── pyproject.toml
└── README.md
Architecture
The project uses the Observer pattern to decouple game logic from the view, with abstract interfaces for dependency inversion.
Components
| Component | Role |
|---|---|
Tetromino(ITetromino) |
Falling piece with clockwise rotation |
Board(IBoard) |
Pure grid engine — collision, locking, line clearing |
Tetris(ITetris) |
Game orchestrator; fires EventType events on every state change |
MenuScreen(IView) |
Kivy main menu with language selector |
GameScreen(IView) |
Kivy 10×20 board, previews, score, keyboard input |
TetrisApp(App) |
Kivy application; manages screen transitions |
I18n |
Runtime EN/IT string lookup |
BlockRenderer |
Maps piece integers to RGBA colours and image paths |
Observer events (EventType enum)
| 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 |
Keyboard controls
| Key | Action |
|---|---|
| ← / → | Move left / right |
| ↓ | Soft drop |
| ↑ or X | Rotate clockwise |
| Space | Hard drop |
| C | Hold |
| P or Escape | Pause / Resume |
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
Metadata
Release files for OrecchietTetris 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| orecchiettetris-0.9.0.tar.gz | 26.6 kB | With provenance | Details for orecchiettetris-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| orecchiettetris-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for orecchiettetris-0.9.0-py3-none-any.whl |
Total release size: 70.4 kB
Release files / orecchiettetris-0.9.0.tar.gz
| Download URL | orecchiettetris-0.9.0.tar.gz |
|---|---|
| Size | 26.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f848621a0a3093469287bbda5914afd5461f859411f4e24f1b73b0209fbcfb22
|
|
BLAKE2b-256 checksum How to use checksums |
e40ad52479f0858255a18ecfb22edf4eb198b511922f61ff4e5a8f853cc44e83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logRelease files / orecchiettetris-0.9.0-py3-none-any.whl
| Download URL | orecchiettetris-0.9.0-py3-none-any.whl |
|---|---|
| Size | 43.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
595502cfbb32de9556f714c9551e7c736ee898f4995c266da4fb7c2be53f801b
|
|
BLAKE2b-256 checksum How to use checksums |
d9203b8feebf0c5efd3d69f1841c8bd143a3fcdb4349e737cded22c325a5a864
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logSecurity for OrecchietTetris 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for orecchiettetris-0.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.