LinuxCommandLibrary

tetris-bsd

Play the classic Tetris game

SYNOPSIS


tetris-bsd [-s]

PARAMETERS

-s
    Displays the current high scores recorded for the game without starting a new game session.

DESCRIPTION


tetris-bsd is a terminal-based implementation of the popular puzzle video game, Tetris. The objective is to manipulate falling blocks (tetrominoes) by moving and rotating them to form complete horizontal lines without gaps. When a line is completed, it disappears, and the blocks above it fall to fill the space, scoring points. The game continues until the stack of blocks reaches the top of the playing field, at which point the game ends. This version is part of the bsdgames collection, providing a nostalgic text-mode gaming experience directly within the command line interface.

It supports essential gameplay mechanics including moving left/right, rotating, soft dropping, and hard dropping blocks. Users can also pause the game, quit, view high scores, and redraw the screen if terminal issues occur. High scores are persisted, allowing players to track their progress and compete for the top spot. Its simplicity and text-based nature make it a lightweight yet engaging option for a quick game in the terminal.

CAVEATS


This command relies on terminal capabilities and may not display correctly in all terminal emulators or with certain font configurations. It uses ncurses for rendering, requiring a compatible environment. High scores are typically stored in a system-wide file (e.g., /var/games/bsdgames/tetris-scores), which may require appropriate file permissions for writing if the user playing does not have them, though reading is usually always permitted. The game controls are based on common vi-like keybindings, which might be unfamiliar to users accustomed to modern game controls.

GAME CONTROLS


The game uses a specific set of keyboard controls for gameplay:
h, j, k, l (or uppercase versions): Move left, move down (soft drop), rotate left, rotate right respectively.
p (or P): Pause the game.
q (or Q): Quit the game.
Space bar: Drop the block immediately (hard drop).
^L (Control-L): Redraw the screen, useful if terminal display gets corrupted.
^Z (Control-Z): Suspend the game (sends it to background).

HISTORY


The tetris game, as part of the bsdgames collection, has a long history rooted in the Unix and BSD operating systems. The original Tetris game was created by Alexey Pajitnov in 1984. The Unix versions, like tetris-bsd, aim to replicate the classic experience in a text-based terminal environment. This specific version was written by Ken Koppen and later adapted to use the ncurses library by John B. Roll, making it portable across various Unix-like systems. It's often found in distributions' "bsdgames" packages, maintaining a tradition of including classic, simple games that are lightweight and readily available on command-line systems. Its development reflects the early days of computing where graphical interfaces were not standard, emphasizing efficiency and terminal compatibility.

SEE ALSO

bsdgames(6), ncurses(3)

Copied to clipboard