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

  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/
│   │   │   ├── 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

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.7.3.tar.gz (18.1 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.7.3-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for orecchiettetris-0.7.3.tar.gz
Algorithm Hash digest
SHA256 9ae0465387404deae7c4acfc100637ad461047a82f69c99146f3b1f5a48eda3d
MD5 9aa367341006976a970ffe126f756b8e
BLAKE2b-256 0af6e9f5e02c39081c1bc1eb4644a7223dff346e6dd3ee1a632041bc1e850087

See more details on using hashes here.

Provenance

The following attestation bundles were made for orecchiettetris-0.7.3.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.7.3-py3-none-any.whl.

File metadata

File hashes

Hashes for orecchiettetris-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1c02e90a4c376e76ccd74ec8c3d281e91a466e8ab3a3aee5a48ba97e6f2411ed
MD5 462d399e6b85623dd4e4950f4a47df7a
BLAKE2b-256 0175f25ab5809530a1387335f9f1b1f2cd202ea154dd0bb6d62800f4a194f546

See more details on using hashes here.

Provenance

The following attestation bundles were made for orecchiettetris-0.7.3-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