A Tetris game running in the Linux terminal.
- Install CMake.
- Install GoogleTest.
- Install ncurses.
Set the location to the project folder and run:
mkdir build
cd build
cmake ..
cmake --build .
Set the location to the build
folder and run:
ctest -VV
Set the location to the build/bin
folder and run:
./tetris -x=<width> -y=<height>
For example:
./tetris -x=10 -y=15
.
โโโ .clang-format
โโโ .gitignore
โโโ CITATION.cff
โโโ CMakeLists.txt
โโโ Dockerfile
โโโ LICENSE
โโโ README.md
โโโ cover.png
โโโ docs
โ โโโ badges
โ โโโ C++.svg
โ โโโ License-MIT.svg
โ โโโ Linux.svg
โ โโโ Made-with-CMake.svg
โ โโโ Made-with-GitHub-Actions.svg
โ โโโ Made-with-Docker.svg
โโโ include
โ โโโ args.h
โ โโโ color.h
โ โโโ controller.h
โ โโโ game.h
โ โโโ grid.h
โ โโโ location.h
โ โโโ rotation.h
โ โโโ shape.h
โ โโโ tetromino.h
โโโ src
โ โโโ CMakeLists.txt
โ โโโ args
โ โ โโโ CMakeLists.txt
โ โ โโโ args.cpp
โ โโโ color
โ โ โโโ CMakeLists.txt
โ โ โโโ color.cpp
โ โโโ controller
โ โ โโโ CMakeLists.txt
โ โ โโโ controller.cpp
โ โ โโโ ui
โ โ โโโ board.h
โ โ โโโ color_env.cpp
โ โ โโโ color_env.h
โ โ โโโ grid_board.h
โ โ โโโ next_tetromino_board.h
โ โ โโโ score_board.h
โ โโโ game
โ โ โโโ CMakeLists.txt
โ โ โโโ game.cpp
โ โโโ grid
โ โ โโโ CMakeLists.txt
โ โ โโโ grid.cpp
โ โโโ location
โ โ โโโ CMakeLists.txt
โ โโโ main.cpp
โ โโโ rotation
โ โ โโโ CMakeLists.txt
โ โ โโโ rotation.cpp
โ โโโ shape
โ โ โโโ CMakeLists.txt
โ โโโ tetromino
โ โโโ CMakeLists.txt
โ โโโ subtype
โ โ โโโ i.h
โ โ โโโ j.h
โ โ โโโ l.h
โ โ โโโ o.h
โ โ โโโ s.h
โ โ โโโ t.h
โ โ โโโ z.h
โ โโโ tetromino.cpp
โโโ tests
โโโ CMakeLists.txt
โโโ grid_test.cpp
โโโ rotation_test.cpp
โโโ tetromino_test.cpp
classDiagram
class Colored {
<<interface>>
GetColor() Color
SetColor(Color)
}
class Rotatable {
<<interface>>
RotateLeft()
RotateRight()
GetAngle() Angle
RotateTo(Angle)
}
class Locatable {
<<interface>>
GetPosition() Point
}
class Movable {
<<interface>>
SetPosition(Point)
}
Locatable <|-- Movable
class Shape {
<<interface>>
GetHeight() int
GetWidth() int
Filled(Point) bool
}
class Tetromino {
<<abstract>>
GetTetrominoByAngle(Angle) Tetromino
}
Shape <|.. Tetromino
Rotatable <|.. Tetromino
Colored <|.. Tetromino
Tetromino <|-- I
Tetromino <|-- O
Tetromino <|-- J
Tetromino <|-- L
Tetromino <|-- S
Tetromino <|-- T
Tetromino <|-- Z
class Grid {
GetColor(Point) Color
PushTetromino(Tetromino, Point) bool
MoveTetrominoToLeft() bool
MoveTetrominoToRight() bool
RotateTetrominoLeft() bool
RotateTetrominoRight() bool
TetrominoDescend(int& cleared_line_count) bool
}
Shape <|.. Grid
Grid *-- Tetromino
Movable <|.. MovableTetromino
MovableTetromino --> Tetromino
Grid --> MovableTetromino
class Action {
<<enumeration>>
Non
MoveToLeft
MoveToRight
RotateLeft
RotateRight
Descend
}
class Game {
Start()
Act(Action) ActionResult
GetNextTetrominoes() Tetromino
GetScore() int
IsOver() bool
}
Game --> Grid
Game ..> Action
class Controller {
Input()
Update()
Refresh()
}
Controller --> Game
Distributed under the MIT License. See LICENSE
for more information.