This repository contains a simple yet stylish Snake Game built with Pygame. The goal is to guide the snake around the screen collecting food while avoiding collisions with your own body. Each piece of food you eat will make the snake grow longer and increase your score.
- Ensure you have Python 3 installed.
- (Recommended) Create a virtual environment to keep dependencies isolated:
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`- Install the required dependencies:
pip install pygameActivate the virtual environment if you created one, then run the game script:
python snake_game.pyWhen the game starts you can choose to play yourself or watch the built-in AI play. Use the arrow keys in human mode to control the snake. The game ends if the snake collides with itself. Your score is displayed in the corner and on the game over screen.
When you're done playing, exit the virtual environment with:
deactivatesnake_game.py– Main game logic implemented with Pygame.ENGINEERING.md– Technical documentation describing how the game is organized.
Enjoy playing!