Skip to content

algoboy-kevin/neat-snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Algoboy-Kevin
Jul 31, 2024
5bd3728 · Jul 31, 2024

History

9 Commits
Jul 31, 2024
Jul 31, 2024
Jul 28, 2024
Jul 31, 2024
Jul 29, 2024
Jul 28, 2024
Jul 31, 2024
Jul 31, 2024
Jul 31, 2024
Jul 29, 2024
Jul 28, 2024
Jul 29, 2024

Repository files navigation

neat-snake

This Python repository contains a testing environment and implementation of the NEAT algorithm for the classic game of Snake.

alt text

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 commandpip 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 - Snake env logic and network render reference.

Feel free to contribute to this project by submitting pull requests or suggesting improvements. Happy coding!

Releases

No releases published

Packages

No packages published

Languages