A CLI recreation of Tetris โ right in your terminal. ๐ฎ
"The classic puzzle game, rebuilt for the terminal."
npx @engelde/tetris-cliOne command. No install. Just play.
Want it installed? Run
npm install -g @engelde/tetris-clithen just typetetris.
A terminal recreation of Tetris โ the puzzle game that defined a genre. Seven pieces, one board, infinite challenge. Built with TypeScript, React, and Ink for smooth 60 FPS terminal rendering.
- ๐ Marathon โ Classic score chase with increasing speed
- ๐ค vs CPU โ Battle an AI opponent on Easy, Normal, or Hard
- ๐ฅ 2-Player โ Same-keyboard duel with garbage attacks
- ๐ฒ 7-Bag Randomizer โ Fair piece distribution every game
- ๐ SRS Rotation โ Full wall kicks and spin detection
- ๐ฆ Hold Piece โ Swap and strategize
- ๐ป Ghost Piece โ See exactly where you'll land
- ๐ฅ Combos & Back-to-Back โ Advanced scoring for pros
- ๐๏ธ Garbage System โ Send lines to your opponent
- ๐ Local High Scores โ Persisted in
~/.tetris-cli-scores.json - ๐ Sound Effects โ Native chiptune-style game cues (disable with
--no-sound)
| Action | Keys |
|---|---|
| Move left | A / Left Arrow |
| Move right | D / Right Arrow |
| Soft drop | S / Down Arrow |
| Hard drop | W / Up Arrow |
| Rotate clockwise | K / Z / Space |
| Rotate counter-clockwise | J / X |
| Hold | H / C |
| Pause | P / Escape |
| Quit | Q / Ctrl+C |
| Action | Keys |
|---|---|
| Move left | Left Arrow |
| Move right | Right Arrow |
| Soft drop | Down Arrow |
| Hard drop | Up Arrow / Space |
| Rotate clockwise | , / . |
| Rotate counter-clockwise | / / > |
| Hold | ; / L |
| Flag | Description | Default |
|---|---|---|
--mode <mode> |
marathon, cpu, or 2p |
Interactive menu |
--difficulty <level> |
easy, normal, or hard |
normal |
--no-sound |
Disable sound effects | Sound enabled |
--help, -h |
Show help | โ |
--version, -v |
Show version | โ |
# Examples
npx @engelde/tetris-cli --mode marathon --difficulty easy --no-sound
npx @engelde/tetris-cli --mode cpu --difficulty hard
npx @engelde/tetris-cli --mode 2p๐ฏ Master the hold โ Save an I-piece for the perfect Tetris setup.
๐ Learn SRS wall kicks โ A well-timed rotation can save a piece from a tight spot.
โก Combos add up โ Clearing lines back-to-back sends massive garbage in versus modes.
๐ Watch the ghost โ The ghost piece shows your landing spot. Use it to plan ahead.
git clone https://github.com/engelde/tetris-cli.git
cd tetris-cli
npm install| Command | Description |
|---|---|
npm start |
Run the game |
npm test |
Run tests |
npm run build |
Compile TypeScript |
npm run lint |
Lint with Biome |
npm run format |
Format with Biome |
Husky runs linting + tests on pre-commit and enforces Conventional Commits. CI runs on Node 22 / 24. npm publishing is triggered from a published GitHub Release using NPM_TOKEN and provenance.
Inspired by the original Tetris created by Alexey Pajitnov in 1984. This is an independent, open-source recreation with no affiliation with The Tetris Company.