A classic Snake game built with Python and Pygame, enhanced with AI capabilities using PyTorch.
git clone https://github.com/alouiadel/ai-snake-game.git
cd ai-snake-game
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On Windows
venv\Scripts\activate
# On macOS/Linux
# source venv/bin/activate
# Install requirements
pip install -r requirements.txt
- Use arrow keys to control the snake
- Eat food (🔴) to grow and score points
- Avoid hitting yourself!
python snake-game-entry.py
⬆️ Up Arrow: Move Up ⬇️ Down Arrow: Move Down ⬅️ Left Arrow: Move Left ➡️ Right Arrow: Move Right
Press Y to play again or N to quit
- Train the AI to play the game by selecting "Train AI" from the main menu
- Watch the AI play the game by selecting "Watch AI Play" from the main menu (requires a trained model)
- Python 3.x
- Pygame
- PyTorch
- Numpy
For CUDA-enabled PyTorch, visit PyTorch Get Started for details.
This project is licensed under the MIT License - see the LICENSE file for details.