https://github.com/lemonyte/terminal-snake
The classic Snake game, in your terminal.
https://github.com/lemonyte/terminal-snake
ascii game pyco python snake snake-game terminal
Last synced: 4 months ago
JSON representation
The classic Snake game, in your terminal.
- Host: GitHub
- URL: https://github.com/lemonyte/terminal-snake
- Owner: lemonyte
- License: mit
- Created: 2021-09-07T16:20:27.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-06T06:49:13.000Z (over 1 year ago)
- Last Synced: 2025-03-28T07:41:40.537Z (about 1 year ago)
- Topics: ascii, game, pyco, python, snake, snake-game, terminal
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# Terminal Snake
The classic Snake game, in your terminal.

This project was created as a demo for the [Pyco](https://github.com/lemonyte/pyco) library.
## Installation
With uv:
```shell
uv tool install git+https://github.com/lemonyte/terminal-snake
```
With pip:
```shell
pip install git+https://github.com/lemonyte/terminal-snake
```
Requires [Python 3.9](https://www.python.org/downloads/) or higher.
## Usage
### Command line
```shell
snake [--auto] [--speed ]
```
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.
### Controls
| 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.
## Contributing
Contributions are welcome!
### Challenge
If you have an implementation for the [CPU snake player](src/snake/auto.py) that can achieve a higher score or win the game, please do open an issue or pull request.
## Removed features
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
## License
[MIT License](license.txt)