LinuxCommandLibrary

nsnake

Play the classic snake game in terminal

TLDR

Start a snake game

$ nsnake
copy

Navigate the snake
$ [<ArrowUp>|<ArrowDown>|<ArrowLeft>|<ArrowRight>]
copy

Pause/unpause the game
$ <p>
copy

Quit the game
$ <q>
copy

Display help during the game
$ <h>
copy

SYNOPSIS

nsnake

DESCRIPTION

The nsnake command launches a simple, yet addictive, terminal-based implementation of the classic Snake game. Utilizing the ncurses library, it provides a retro text-based graphical interface for playing. The objective is to control a growing snake to eat 'food' items, which increases its length. Players must navigate the snake around the screen, avoiding collisions with the boundaries of the play area and its own ever-lengthening tail. As the snake grows, the game typically increases in speed, raising the challenge. It's a lightweight, fun way to pass time directly within your command-line environment, perfect for quick breaks or demonstrating basic terminal capabilities.

CAVEATS

Due to its text-based nature, nsnake's appearance and responsiveness can be affected by the terminal emulator used, its font settings, and the terminal window size. A sufficiently large terminal window is recommended for optimal display. If the terminal is too small, the game might not render correctly or may truncate the display. Exiting the game is usually done by pressing 'q' or 'Ctrl+C'.

CONTROLS

Gameplay in nsnake is controlled using the standard arrow keys:
Up Arrow: Move snake upwards
Down Arrow: Move snake downwards
Left Arrow: Move snake left
Right Arrow: Move snake right
To quit the game, typically press 'q' or 'Ctrl+C'.

GAMEPLAY

The game starts with a short snake on a grid. Scattered randomly is a 'food' item. Guide the snake to consume the food, which makes the snake grow longer and earns points. New food appears after each consumption. The challenge increases as the snake gets longer and sometimes faster, requiring more precise movements. The game ends when the snake collides with the terminal boundaries or with its own body.

HISTORY

nsnake was developed by Alexandre Dantas as a straightforward and portable ncurses-based game. It became a popular package in various Linux distributions due to its simplicity, small footprint, and adherence to the classic Snake gameplay. Its development focuses on providing a clean, functional terminal game without complex features, making it a stable and widely available utility for casual entertainment on the command line.

SEE ALSO

ncurses(3), ncurses(1), games(6), tetris(6), cowsay(1)

Copied to clipboard