Skip to content

selvan-01/AI-Snake-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 AI Snake Game (Manual + AI Mode)

A complete Snake Game project built using Python and Pygame, featuring both manual gameplay and AI-powered automation. This project demonstrates game development, logic building, and AI-based problem solving.


🚀 Features

🎮 Manual Snake Game

  • Control snake using arrow keys
  • Real-time movement and collision detection
  • Score tracking system
  • Game over on wall or self collision

🤖 AI Snake Game

  • Automated snake movement using intelligent algorithms
  • Supports:
    • Greedy Algorithm
    • Hamiltonian Path Algorithm
  • Demonstrates AI decision-making concepts

🛠️ Tech Stack

  • Python 🐍
  • Pygame 🎮
  • Basic AI Algorithms 🤖

📂 Project Structure

AI-SNAKE-GAME/ │ ├── snake/
├── logs/
│ ├── AI_SnakeGame.py
├── Manual_SnakeGame.py
│ ├── requirements.txt
└── README.md


⚙️ Installation & Setup

  1. Clone the repository: git clone https://github.com/selvan-01/AI-Snake-Game.git

  2. Navigate to project folder: cd AI-Snake-Game

  3. Install dependencies: pip install -r requirements.txt


▶️ How to Run

Run Manual Snake Game: python Manual_SnakeGame.py

Run AI Snake Game: python AI_SnakeGame.py


🎯 Controls (Manual Mode)

↑ Arrow - Move Up
↓ Arrow - Move Down
← Arrow - Move Left
→ Arrow - Move Right


🧠 AI Algorithms Used

Greedy Solver:

  • Fast decision making
  • Moves directly towards food
  • May fail in complex situations

Hamiltonian Solver:

  • Follows a fixed safe path
  • Ensures longer survival
  • Slower but reliable

📈 Learning Outcomes

  • Game development using Pygame
  • Event handling and rendering
  • Collision detection logic
  • AI pathfinding basics
  • Clean code structuring

🔥 Future Improvements

  • Add difficulty levels
  • Implement Reinforcement Learning
  • Add sound effects and UI improvements
  • Leaderboard system

🔗 Links

👨‍💻 Author

S. Senthamil Selvan (Sen)
Aspiring Data Analyst | AI Developer


⭐ Support

If you like this project:

  • Star the repository
  • Share with others
  • Connect on LinkedIn

📢 License

This project is open-source and created for learning purposes.

About

AI-powered snake game using Python and Pygame with manual gameplay and intelligent algorithms like greedy and Hamiltonian path.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages