This project features an AI that learns to play Snake autonomously using the NEAT (NeuroEvolution of Augmenting Topologies) algorithm. No hardcoded strategies โ the agent improves over generations through genetic mutations and natural selection. ๐งฌ๐ค
๐น๏ธ The AI controls a snake in a classic grid-based Snake game.
๐งฌ It evolves over time using NEAT: networks mutate, reproduce, and get selected based on performance (fitness).
๐๏ธ Visual interface shows the best snake live as it learns.
๐ No supervised learning โ only evolution by fitness
๐ง Networks evolve topologies and weights
๐ Real-time simulation with visualization
๐ Tracks best fitness, average scores, and generation progress
Here is an image of what it looks like :
- Python 3.x ๐
- neat-python
- pygame for visualization ๐ฎ
โณ Training takes time โ early generations play poorly but evolve quickly. I train it approximately 15h and the best score is 13 apples. Here is the best neural network :
๐งช You can adjust mutation rates, population size, and other parameters in the NEAT config file.