This project is a Snake Game powered by AI search algorithms, built with Python and Pygame.
Instead of manual control, the snake automatically finds the best path to food using algorithms like BFS, DFS, UCS, IDS, Greedy BFS, and A* while avoiding obstacles.
- Multiple AI pathfinding algorithms:
- Random Movement
- Breadth-First Search (BFS)
- Depth-First Search (DFS)
- Iterative Deepening Search (IDS)
- Uniform Cost Search (UCS)
- Greedy Best-First Search
- A* Search
- Adjustable difficulty levels with increasing obstacle density
- Countdown timer (30 seconds) per game
- Dynamic score tracking
- Built with Pygame for visualization
โโโ https://raw.githubusercontent.com/kirat5504/AI-Snake-Game/main/Lygosoma/Game-A-Snake-v1.4.zip # Pathfinding algorithms โโโ https://raw.githubusercontent.com/kirat5504/AI-Snake-Game/main/Lygosoma/Game-A-Snake-v1.4.zip # Main Snake game with AI integration โโโ https://raw.githubusercontent.com/kirat5504/AI-Snake-Game/main/Lygosoma/Game-A-Snake-v1.4.zip # Project documentation
-
Clone this repository:
git clone https://raw.githubusercontent.com/kirat5504/AI-Snake-Game/main/Lygosoma/Game-A-Snake-v1.4.zip cd ai-snake-game -
Install dependencies: pip install pygame
-
Run the game: python https://raw.githubusercontent.com/kirat5504/AI-Snake-Game/main/Lygosoma/Game-A-Snake-v1.4.zip <search_algorithm>
level0 โ no obstacles level1 โ 5% obstacles level2 โ 10% obstacles level3 โ 15% obstacles
bfs, dfs, ucs, ids, a*, random, greedy_bfs
Example: python https://raw.githubusercontent.com/kirat5504/AI-Snake-Game/main/Lygosoma/Game-A-Snake-v1.4.zip level2 astar
Snake automatically finds the path to food. Obstacles appear depending on level difficulty. Game ends if the snake hits a wall, obstacle, or timer runs out. Score increases when food is collected.