Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/k3ury99/ai-powered-snake-game

The AI-Powered-Snake-Game offers two versions of Snake: a classic manual control version and an advanced AI-controlled version using A* pathfinding. Both versions feature customizable options and unique gameplay elements, providing diverse and challenging experiences.
https://github.com/k3ury99/ai-powered-snake-game

artificial-intelligence python3 snake-game

Last synced: 2 months ago
JSON representation

The AI-Powered-Snake-Game offers two versions of Snake: a classic manual control version and an advanced AI-controlled version using A* pathfinding. Both versions feature customizable options and unique gameplay elements, providing diverse and challenging experiences.

Awesome Lists containing this project

README

        

# ๐Ÿš€ AI-Powered-Snake-Game

> [!NOTE]
The AI-Powered-Snake-Game is an engaging Python project featuring two versions of the classic Snake game using Pygame. The Normal Version offers traditional gameplay with manual controls, while the AI Version showcases a self-playing snake managed by an AI algorithm with A* pathfinding for optimal performance. Both versions include customizable features and unique gameplay elements, providing players with diverse and challenging experiences.




### This project contains two versions of the classic Snake game implemented in Python using Pygame:

1. **Normal Version**: A traditional Snake game with manual controls.
2. **AI Version**: An advanced version where the snake is controlled by an AI algorithm, making it more challenging and self-playing. It has this design so that the snake finds the fastest and safest route, making the snake survive for as long as possible, making it very difficult for it to die.

## ๐ŸŽฎ Features

### Normal Version
- Classic Snake gameplay
- Manual control using arrow keys
- Customizable snake and food colors
- Game over screen with restart option
- Score tracking

### AI Version
- Self-playing Snake controlled by AI
- A* pathfinding algorithm for optimal moves
- Ghost trail effect
- Wraparound screen edges
- Grid display for better visualization
- Game over and win conditions

## ๐Ÿ› ๏ธ Technologies Used

- Python
- Pygame
- A* Pathfinding Algorithm (AI Version)

## ๐Ÿš€ Installation

1. Clone the repository:
2. Navigate to the project directory: cd ai-snake-game
3. Install the required dependencies: pip install pygame

## ๐Ÿ•น๏ธ How to Play

### Normal Version
- Run the game: python snake_game.py

- Use arrow keys to control the snake
- Eat food to grow and increase your score
- Avoid colliding with walls or the snake's body

### AI Version
- Run the game: python ai_snake_game.py

- Watch as the AI controls the snake to maximize its score
- The game ends when the snake fills the entire grid

## ๐ŸŽจ Customization

### ๐Ÿ–‡Normal Version
- Press 1-3 to change snake color
- Press 4-6 to change food color

### ๐Ÿ–‡AI Version
- Adjust game speed in the `run()` method

## ๐Ÿค Contributing

Contributions, issues, and feature requests are welcome! Feel free to check [issues page](https://github.com/yourusername/ai-snake-game/issues).

## ๐Ÿ“œ License

This project is [MIT](https://choosealicense.com/licenses/mit/) licensed.

## ๐Ÿ‘จโ€๐Ÿ’ป Author

- GitHub: https://github.com/K3ury99
- LinkedIn: https://www.linkedin.com/in/keury03/