An interactive CLI Snake game, tested on Python 2.7 and 3.6 Posix environments.
- Use the arrow keys to guide the snake around the game board.
- Score points by collecting food.
- Avoid colliding with walls, or your own body.
Install from PyPi using pip, a package manager for Python.
$ pip install py-snake
Or clone the repo and install using setuptools.
$ cd path/to/repo
$ python setup.py develop
Both methods will create an executable snake
for your active Python environment. Whenever this environment is active, snake
will be scoped in your PATH making it playable from any working directory.
After installation, start a new game by running snake
from any directory on command line.
$ snake
Optionally pass the --help
flag to see options available for game configuration.
$ snake --help
usage: snake [-h] [--width WIDTH] [--height HEIGHT] [--speed SPEED]
[--food FOOD]
Snake game for CLI
optional arguments:
-h, --help show this help message and exit
--width WIDTH Frame width
--height HEIGHT Frame height
--speed SPEED Snake speed (fps)
--food FOOD Number of food pieces available
If the snake
command stops working after a successful installation, check that you have the correct Python environment activated. You may need to manually activate the Python environment from a new terminal session, depending on how your environment is configured.
Uninstall py-snake using pip.
$ pip uninstall py-snake