Skip to content

A terminal-based implementation of the classic Tetris game using the Lanterna library. Designed to run in any terminal emulator, this project delivers a minimalist gaming experience. Features include intuitive keyboard controls, score tracking, progressively increasing difficulty levels, and monochrome block rendering.

License

Notifications You must be signed in to change notification settings

Akineyshen/TetrisLanterna

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris Lanterna

Language Library Size Last Commit

Features

  • Keyboard Controls: Move and rotate Tetris blocks using arrow keys.
  • Game Over Handling: Detects when the game ends and allows restarting.
  • Score Tracking: Keeps track of the player's score and cleared lines.
  • Level Progression: Increases difficulty as the player clears more lines.
  • Text-Based Rendering: Uses the Lanterna library for terminal-based graphics.
  • MVC Architecture: Clean separation of concerns with Model-View-Controller design.
  • Dynamic Piece Generation: Randomly generates Tetris pieces for gameplay.
  • Line Clearing: Automatically removes full lines and updates the score.

Unit testing

  • ControllerTest: Verifies input handling (e.g., arrow keys, game restart) and ensures the view is updated correctly.
  • ModelTest: Tests for game logic, including piece movement, line clearing, scoring, and game state.
  • ViewTest: Ensures the display is updated correctly based on the model's state, including rendering pieces and game over messages.
  • TetrisTest: Verifies the successful initialization of all core Tetris game components (Screen, Model, View, and Controller).

Test coverage

Requirements

  • Java: JDK 21 or newer.
  • Maven: For dependency management and building the project.
  • Lanterna: Terminal-based rendering library.

Installation

  1. Clone the repository:
    git clone https://github.com/Akineyshen/TetrisLanterna.git
  2. Navigate to the project directory:
    cd TetrisLanterna
  3. Build the project using Maven:
    mvn clean install
  4. Navigate to the target Folder:
    Open the target folder.
  5. Run the game:
    Right-click on the file Tetris-Lanterna.jar.
    Select Run from the context menu.

Project Structure

TetrisLanterna/
├── src/                     # Source code
│   ├── main/
│   │   ├── java/
│   │   │   ├── controller/  # Controller logic
│   │   │   ├── model/       # Game logic and data
│   │   │   ├── view/        # Rendering logic
│   │   │   └── Tetris.java  # Main entry point
│   │   └── resources/       # Game resources
│   └── test/                # Unit tests
├── .gitignore               # Ignored files
├── pom.xml                  # Maven configuration
└── README.md                # Project description

Screenshots

Tetris

Game Over

About

A terminal-based implementation of the classic Tetris game using the Lanterna library. Designed to run in any terminal emulator, this project delivers a minimalist gaming experience. Features include intuitive keyboard controls, score tracking, progressively increasing difficulty levels, and monochrome block rendering.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages