A classic Snake game implementation that runs in the terminal, built with Python and the curses library.
- Control the snake using arrow keys
- Eat food ($) to grow and increase score
- Avoid hitting walls (#) or yourself
- Score tracking based on food consumed
- Game over screen with final score display
- Python 3.x
- curses library (comes built-in with Python on Unix-like systems)
- Windows users may need to install
windows-cursesvia pip:
pip install windows-curses- Clone the repository:
git clone https://github.com/makalin/Snake-Terminal.git
cd Snake-Terminal- Run the game:
python snake.py- Controls:
- Arrow Keys: Move the snake up, down, left, or right
- Q: Quit the game at any time
- The snake is represented by 'O' (head) and 'o' (body)
- Food is shown as '$'
- Walls are represented by '#'
- Eat food to grow longer and increase your score
- Game ends if you hit a wall or the snake's own body
- Uses Python's curses library for terminal interface
- Main game loop handles input, movement, and collision detection
- Random food spawning system
- Score tracking and display
Score: 2
####################
# #
# Oooo$ #
# #
# #
####################
Feel free to fork the repository and submit pull requests with improvements such as:
- High score tracking
- Speed increase with score
- Different food types
- Color support
This project is open-source and available under the MIT License.