Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

alouiadel/ai-snake-game

Repository files navigation

🐍 AI Snake Game

A classic Snake game built with Python and Pygame, enhanced with AI capabilities using PyTorch.

AI Snake Game Demo

🛠️ Setup Instructions

Clone the Repository

git clone https://github.com/alouiadel/ai-snake-game.git
cd ai-snake-game

Set Up Virtual Environment

# 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

🎮 How to Play

  • Use arrow keys to control the snake
  • Eat food (🔴) to grow and score points
  • Avoid hitting yourself!

🚀 Quick Start

python snake-game-entry.py

🎯 Controls

⬆️ Up Arrow: Move Up ⬇️ Down Arrow: Move Down ⬅️ Left Arrow: Move Left ➡️ Right Arrow: Move Right

🔄 Game Over

Press Y to play again or N to quit

🧠 AI Features

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

🛠️ Requirements

  • Python 3.x
  • Pygame
  • PyTorch
  • Numpy

For CUDA-enabled PyTorch, visit PyTorch Get Started for details.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages