Jump to content

tetris

From Hugo's wiki

tetris is Tetris for the TTY, or any terminal emulator, written in C.

tetris

Features

  • Score, random piece colors, and speed that increases as pieces land.
  • Customizable controls and board size.
  • Lightweight and portable.
  • A library, tetris.h, to build your own client.

Installation

$ git clone https://github.com/hugoocoto/tetris
$ cd tetris
$ make install    # copies to /usr/local/bin, needs sudo
$ tetris

Or make all and ./tetris without installing. sudo make uninstall removes it. It is also available through the pm user repository.

Controls

Key Action
w Rotate
a, d Move left / right
s Move down
space Drop

Change them before compiling with bind(key, function) in main.c; bindable functions are listed in tetris.h. There is no quit key yet: Esc or Ctrl-C end the game.

Custom client

make compile builds the library; link your own program against it:

$ gcc client.c -L. -lttytetris -lpthread

See also