The classic Snake game, in your terminal.
This project was created as a demo for the Pyco library.
With uv:
uv tool install git+https://github.com/lemonyte/terminal-snake
With pip:
pip install git+https://github.com/lemonyte/terminal-snake
Requires Python 3.9 or higher.
snake [--auto] [--speed <int>]
The auto
flag will let the snake control itself.
The speed
option controls the speed of the game in updates per second. A value of 0 translates to no delay, so the game will run as fast as possible.
Key | Description |
---|---|
ESC or q | Exit the game |
SPACE | Pause the game |
w | Move up |
a | Move left |
s | Move down |
d | Move right |
When resizing the terminal, pause and unpause the game with SPACE to update the internal pixel grid accordingly.
Contributions are welcome!
If you have an implementation for the CPU snake player that can achieve a higher score or win the game, please do open an issue or pull request.
The previous version of this game had a number of features that were removed due to implementation complexity. They may be added back later.
- Looping through walls
- Configurable colors
- Snake speed based on length