A classic snake game implementation for the terminal using Python's curses library. Control the snake with arrow keys, eat food to grow longer, and avoid hitting the walls or your own tail!
- Arrow key controls (↑, ↓, ←, →)
- Snake grows with each food eaten
- Score tracking
- Game over on collision with walls or self
- Border display
- Food represented with special character
- Python 3.x
- curses library (pre-installed on Unix/Linux/macOS, Windows users need windows-curses)
pip install windows-cursesNo additional installation needed (curses is built-in)
python terminal_snake_game.py- Run the script
- Use arrow keys to control the snake direction
- Eat the food (π symbol) to grow and increase score
- Avoid hitting walls or your own body
- Press Ctrl+C or let the game end to exit
- ↑: Move up
- ↓: Move down
- ←: Move left
- →: Move right
- Ctrl+C: Quit game
Feel free to submit issues and enhancement requests!
This project is part of the 100 Lines of Python Code repository.