liuzhiping1 / tetris

A terminal interface for Tetris

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tetris

A terminal interface for Tetris

terminal-gif

installation

For Mac and ArchLinux, the binaries attached to the GitHub release should suffice (instructions). For other Linux distros, you can try the Linux binary as well but no guarantees. See the other two options, installing from source and dex.

I have not tested Windows, but I do think it should work via dex. Please let me know in an issue if it fails so I can update documentation. Thanks!

github release binaries

Here is a quick way to get the one for your OS:

curl -L https://github.com/samtay/tetris/releases/download/0.1.2/tetris-`uname -s`-`uname -m` -o tetris
chmod +x tetris
sudo mv tetris /usr/local/bin/

If you are on a Linux distro other than ArchLinux, you may see an issue with these dynamically linked binaries, specifically regarding the ncurses distribution. If you see an error such as tetris: error while loading shared libraries: libncursesw.so.6: cannot open shared object file: No such file or directory, an easy fix is to install the ncurses version 5 and then symlink the libncursesw.so.5 library to the missing libncursesw.so.6 library. For example, on a debian based system,

sudo apt update
sudo apt install -y libncursesw5 libncursesw5-dev
sudo ln -s /lib/x86_64-linux-gnu/libncursesw.so.5  /lib/x86_64-linux-gnu/libncursesw.so.6

install from source

First get stack. Then

git clone https://github.com/samtay/tetris.git
cd tetris
stack install tetris

install via dex

dex is a really cool application manager that lets you run executables as docker images, so that you don't need to worry about installing them or their dependencies directly.

# get dex if you don't have it
curl -L http://get.iceburg.net/dex/latest-0.12.x/dex -o dex
chmod +x dex
sudo mv dex /usr/local/bin

# add tetris as a repo
dex repo add tetris https://github.com/samtay/tetris.git

# run tetris
dex run tetris

### optionally install tetris globally ###
export PATH="$HOME/.dex/bin:$PATH"
dex install --global tetris
tetris

usage

The default game is run by simply executing the tetris command. If the unicode characters look a bit wonky in your terminal, you can also run

tetris --ascii-only         # uses [] as preview cell
# or
tetris --preview-chars 'XX' # uses custom characters as preview cell

If you always play on level 6 and want to skip the prompt, you can start the game immediately via

tetris --level 6

Lastly, to see the current highest score, you can run tetris --high-score. And of course, see tetris --help for help.

About

A terminal interface for Tetris

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 98.1%Language:Dockerfile 1.9%