Skip to content

lemonyte/terminal-snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terminal Snake

The classic Snake game, in your terminal.

Screenshot

This project was created as a demo for the Pyco library.

Installation

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.

Usage

Command line

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.

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 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

Releases

No releases published

Packages

No packages published

Languages