https://github.com/algoboy-kevin/neat-snake
Using evolutionary algorithm to solve Snake game
https://github.com/algoboy-kevin/neat-snake
artificial-intelligence neat pygame python reinforcement-learning snake-game
Last synced: 3 months ago
JSON representation
Using evolutionary algorithm to solve Snake game
- Host: GitHub
- URL: https://github.com/algoboy-kevin/neat-snake
- Owner: algoboy-kevin
- Created: 2024-07-28T07:05:59.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-31T14:09:57.000Z (11 months ago)
- Last Synced: 2025-01-30T22:15:52.345Z (5 months ago)
- Topics: artificial-intelligence, neat, pygame, python, reinforcement-learning, snake-game
- Language: Python
- Homepage:
- Size: 10 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# neat-snake
This Python repository contains a testing environment and implementation of the NEAT algorithm for the classic game of Snake.

The Snake game is played on a 10x10 map. Each time the snake eats an apple, its length increases and the fitness score is incremented by 1. The goal is to achieve a fitness score of 20.
## Installation
To install the required dependencies, run the following command`pip install -r requirements.txt`## Usage
There are several options available for running the Snake game:1. **Test Environment**: To test the environment, execute the following command: `python main.py test`
2. **Train Snake**: To train the snake using the NEAT algorithm, use the following command: `python main.py train`
3. **Save and Create Winner Model**: To save and create a winner model after training, run the following command: `python main.py save`
4. **Run Trained Model**: To run a trained model, execute the following command: `python main.py run`
5. **Run Master Model**: To run the master model, execute the following command: `python main.py run_master`Note: The last two commands are the same, but provided separately for clarity.
## Contributors
- [Daniel Chang](https://github.com/danielchang2002) - Snake env logic and network render reference.Feel free to contribute to this project by submitting pull requests or suggesting improvements. Happy coding!